本文整理汇总了PHP中FileUtil::deleteFile方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::deleteFile方法的具体用法?PHP FileUtil::deleteFile怎么用?PHP FileUtil::deleteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtil
的用法示例。
在下文中一共展示了FileUtil::deleteFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
public static function import($id, $file)
{
$newForm = array();
$content = FileUtil::readFile($file);
$printModel = str_replace("'", "\\'", $content);
if (preg_match_all("'<script[^>]*?>.*?</script>'si", $printModel, $script)) {
$scriptStr = implode("\n\r", $script[0]);
$scriptStr = preg_replace("'<script[^>]*?>'", "", $scriptStr);
$scriptStr = str_ireplace("</script>", "", $scriptStr);
$newForm["script"] = $scriptStr;
$printModel = preg_replace("'<script[^>]*?>.*?</script>'si", "", $printModel);
}
if (preg_match_all("'<style[^>]*?>.*?</style>'si", $printModel, $css)) {
$cssStr = implode("\n\r", $css[0]);
$cssStr = preg_replace("'<style[^>]*?>'", "", $cssStr);
$cssStr = str_ireplace("</style>", "", $cssStr);
$newForm["css"] = $cssStr;
$printModel = preg_replace("'<style[^>]*?>.*?</style>'si", "", $printModel);
}
$newForm["printmodel"] = $printModel;
FlowFormType::model()->modify($id, $newForm);
$form = new ICFlowForm($id);
$form->getParser()->parse();
FileUtil::deleteFile($file);
}
示例2: actionIndex
public function actionIndex()
{
$unit = Setting::model()->fetchSettingValueByKey("unit");
$formSubmit = EnvUtil::submitCheck("unitSubmit");
if ($formSubmit) {
$postData = array();
if (!empty($_FILES["logo"]["name"])) {
!empty($unit["logourl"]) && FileUtil::deleteFile($unit["logourl"]);
$postData["logourl"] = $this->imgUpload("logo");
} elseif (!empty($_POST["logourl"])) {
$postData["logourl"] = $_POST["logourl"];
} else {
$postData["logourl"] = "";
}
$keys = array("phone", "fullname", "shortname", "fax", "zipcode", "address", "adminemail", "systemurl");
foreach ($keys as $key) {
if (isset($_POST[$key])) {
$postData[$key] = StringUtil::filterCleanHtml($_POST[$key]);
} else {
$postData[$key] = "";
}
}
Setting::model()->updateSettingValueByKey("unit", $postData);
CacheUtil::update(array("setting"));
$this->success(Ibos::lang("Save succeed", "message"));
} else {
$license = Setting::model()->fetchSettingValueByKey("license");
$data = array("unit" => unserialize($unit), "license" => $license);
$this->render("index", $data);
}
}
示例3: deleteByIds
public function deleteByIds($ids)
{
$id = $files = array();
foreach ($ids as $removeId) {
$record = $this->fetchByPk($removeId);
if (!empty($record["image"])) {
$files[] = $record["image"];
}
$id[] = $record["id"];
}
$this->deleteByPk($id);
foreach ($files as $file) {
if (FileUtil::fileExists(self::BG_PATH . $file)) {
FileUtil::deleteFile(self::BG_PATH . $file);
}
}
}
示例4: import
public static function import($id, $file, $importUser = false)
{
$content = FileUtil::readFile($file);
$xml = XmlUtil::xmlToArray($content);
unset($xml["base"]["flowid"]);
unset($xml["base"]["name"]);
unset($xml["base"]["formid"]);
unset($xml["base"]["sort"]);
$user = array("newuser", "deptid", "uid", "positionid", "autouserop", "autouser", "mailto");
$data = array();
foreach ($xml["base"] as $key => $value) {
$key = strtolower($key);
if (!$importUser && in_array($key, $user)) {
continue;
}
$data[$key] = $value;
}
FlowType::model()->modify($id, $data);
unset($xml["base"]);
unset($data);
FlowProcess::model()->deleteAllByAttributes(array("flowid" => $id));
if (!empty($xml)) {
foreach ($xml as $process) {
unset($process["id"]);
$data = array();
$process["flowid"] = $id;
foreach ($process as $k => $v) {
if (!$importUser && in_array($k, $user)) {
continue;
}
$data[$k] = $v;
}
FlowProcess::model()->add($data);
}
}
FileUtil::deleteFile($file);
}
示例5: getEmailSize
public static function getEmailSize($content, $attachmentId = "")
{
$tmpfile = "data/emailsize.temp";
FileUtil::createFile($tmpfile, $content);
$emailContentSize = FileUtil::fileSize($tmpfile);
FileUtil::deleteFile($tmpfile);
$attFileSize = 0;
if (!empty($attachmentId)) {
$attach = AttachUtil::getAttachData($attachmentId, false);
foreach ($attach as $value) {
$attFileSize += intval($value["filesize"]);
}
}
return intval($emailContentSize + $attFileSize);
}
示例6: delAttach
public static function delAttach($aid)
{
$count = 0;
$aid = is_array($aid) ? implode(",", $aid) : trim($aid, ",");
$attachUrl = FileUtil::getAttachUrl() . "/";
$records = Attachment::model()->fetchAll(array("select" => array("aid", "tableid"), "condition" => "FIND_IN_SET(aid,'{$aid}')"));
foreach ($records as $value) {
$record = AttachmentN::model()->fetch($value["tableid"], $value["aid"]);
if (!empty($record)) {
if (FileUtil::fileExists($attachUrl . $record["attachment"])) {
FileUtil::deleteFile($attachUrl . $record["attachment"]);
$count++;
}
AttachmentN::model()->deleteByPk($value["tableid"], $value["aid"]);
}
}
if ($count) {
Attachment::model()->deleteAll("FIND_IN_SET(aid,'{$aid}')");
}
return $count;
}