本文整理汇总了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());
}
}