标签:wpa path str 文件写入 star errors name err model
方法:
function output($tip, $fileName = ‘success‘)
{
$document = $_SERVER[‘DOCUMENT_ROOT‘];
$newPath = ‘/uploads/‘;
$filePaht = $document. $newPath;
if (!is_dir($filePaht)) {
mkdir($filePaht, 0777, true);
}
$newFileName = $fileName. ‘.txt‘;
$handle=fopen($filePaht. ‘/‘. $newFileName,"a");
fwrite($handle,"\n-------------------------------------------\n");
fwrite($handle,$tip);
fwrite($handle,"\n-------------------------------------------\n");
fclose($handle);
}
调用:
tip = ‘测试‘;
output($tip);
var_dump写入:
ob_start();
var_dump($model->errors, $v);
$result = ob_get_clean();
$this->output($result,‘error‘);
标签:wpa path str 文件写入 star errors name err model
原文地址:http://www.cnblogs.com/aifengguo/p/7003142.html