本文整理匯總了PHP中source\LuLu::info方法的典型用法代碼示例。如果您正苦於以下問題:PHP LuLu::info方法的具體用法?PHP LuLu::info怎麽用?PHP LuLu::info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類source\LuLu
的用法示例。
在下文中一共展示了LuLu::info方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: exist
public static function exist($path)
{
if (is_array($path))
{
$path = self::buildPath($path);
}
LuLu::info($path);
return file_exists($path);
}
示例2: uploadFile
/**
*
* -path
* -url
* -name
* -new_name
* -temp_name
* -type
* -ext
* -size
* -message
*
* @param string $name the form name
* @return array
*/
public static function uploadFile($name)
{
LuLu::info($name, __METHOD__ . ',the form name is ' . $name);
$uploadedFile = UploadedFile::getInstanceByName($name);
if ($uploadedFile === null) {
return ['message' => '沒有文件'];
}
if ($uploadedFile->hasError) {
switch ($uploadedFile->error) {
case '1':
$error = '超過php.ini允許的大小。';
break;
case '2':
$error = '超過表單允許的大小。';
break;
case '3':
$error = '圖片隻有部分被上傳。';
break;
case '4':
$error = '請選擇圖片。';
break;
case '6':
$error = '找不到臨時目錄。';
break;
case '7':
$error = '寫文件到硬盤出錯。';
break;
case '8':
$error = 'File upload stopped by extension。';
break;
case '999':
default:
$error = '未知錯誤。';
}
LuLu::error($error, '上傳文件出錯');
return ['message' => $error];
}
$ymd = date("Ymd");
$save_path = \Yii::getAlias('@attachmentPath') . '/' . $ymd . "/";
$save_url = 'data/attachment/' . $ymd . "/";
if (!file_exists($save_path)) {
mkdir($save_path);
}
$file_name = $uploadedFile->getBaseName();
$file_ext = $uploadedFile->getExtension();
// 新文件名
$new_file_name = date("YmdHis") . '_' . rand(10000, 99999) . '.' . $file_ext;
$uploadedFile->saveAs($save_path . $new_file_name);
return ['path' => $save_path, 'url' => $save_url, 'name' => $file_name, 'new_name' => $new_file_name, 'ext' => $file_ext, 'temp_name' => $uploadedFile->tempName, 'type' => $uploadedFile->type, 'size' => $uploadedFile->size, 'message' => 'ok'];
}
示例3: afterValidate
public function afterValidate()
{
parent::afterValidate();
if (!$this->hasErrors()) {
if ($this->userValidate) {
$this->finalValidate();
}
}
if ($this->hasErrors()) {
LuLu::setErrorMessage($this->getFirstErrors());
LuLu::info($this->errors, 'validate error:' . self::className());
}
}
示例4: getDbError
private function getDbError($message, $params = array())
{
LuLu::info($message, __METHOD__);
if (preg_match('/SQLSTATE\\[HY000\\] \\[2002\\]/', $message)) {
$message = '連接失敗,請檢查數據庫配置';
} elseif (preg_match('/Unknown database|1049/', $message)) {
$message = '未找到數據庫: ' . $params['dbName'] . ' 請先創建該庫';
} elseif (preg_match('/failed to open the DB/', $message)) {
$message = '連接失敗,請檢查數據庫配置: ' . $params['dbHost'];
} elseif (preg_match('/1044/', $message)) {
$message = '當前用戶沒有訪問數據庫的權限';
} else {
//$ret = false;
}
return $message;
}
示例5: afterValidate
public function afterValidate()
{
parent::afterValidate();
if ($this->hasErrors())
{
LuLu::info($this->errors, self::className());
}
}
示例6: afterValidate
public function afterValidate()
{
parent::afterValidate();
if ($this->hasErrors()) {
LuLu::setErrorMessage($this->getFirstErrors());
LuLu::info($this->errors, self::className());
}
}