本文整理汇总了PHP中log::notice方法的典型用法代码示例。如果您正苦于以下问题:PHP log::notice方法的具体用法?PHP log::notice怎么用?PHP log::notice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log
的用法示例。
在下文中一共展示了log::notice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectUid
public function selectUid($email)
{
$sql = "select userId from {$this->table} where email='{$email}' ";
$ret = $this->db->mysqli->query($sql);
if ($this->db->mysqli->error) {
log::warning($sql, "log.wf");
return false;
}
log::notice($sql, "log.nf");
return $ret;
}
示例2: register
/**
* Registers a new injector
*
* @param callable $function The function to register as an injector.
*
* @return void
*/
public static function register(callable $function)
{
$target = null;
$method = null;
if (is_string($function)) {
if (strpos($function, '::') === false) {
$method = $function;
} else {
$parts = explode('::', $function);
$target = $parts[0];
$method = $parts[1];
}
} elseif (is_array($function)) {
$target = $function[0];
$method = $function[1];
}
$has = false;
$put = null;
if (is_null($target) && !is_null($method)) {
$put = $method;
$has = in_array($method, self::$injectors);
} elseif (!is_null($target) && !is_null($method)) {
if (is_string($target)) {
$put = sprintf('%s::%s', $target, $method);
$has = in_array($put, self::$injectors);
} else {
$put = $function;
foreach (self::$injectors as $v) {
if (is_array($v) && $v[0] == $put[0] && $v[1] == $put[1]) {
$has = true;
break;
}
}
}
}
if ($has) {
log::notice('Method has already been registered as an injector.');
}
if (is_null($put)) {
log::error('Error validating callback function registered status.');
}
self::$injectors[] = $put;
}
示例3: addWgetTask
/**
* Add task for a work
* *******************
*
* @param (string) (url) Url for task
* @param (string) (saveAs) Save to this file name
* @return (array)
*/
function addWgetTask($url, $saveAs)
{
function checkPermissions($path)
{
return file_exists($path) && is_dir($path) && is_writable($path) ? true : false;
}
function checkDirectory($dir)
{
if (!checkPermissions($dir)) {
mkdir($dir, 0777, true);
chmod($dir, 0777);
return checkPermissions($dir) ? true : false;
}
return true;
}
log::debug('(call) addWgetTask() called, $url=' . var_export($url, true) . ', $saveAs=' . var_export($saveAs, true));
define('OriginalTaskUrl', $url);
// Save in constant original task url
if (empty($url)) {
return array('result' => false, 'msg' => 'No URL');
}
if (defined('WGET_ONE_TIME_LIMIT') && count(getWgetTasks()) + 1 > WGET_ONE_TIME_LIMIT) {
log::notice('Task not added, because one time tasks limit is reached');
return array('result' => false, 'msg' => 'One time tasks limit is reached');
}
if (!defined('DOWNLOAD_PATH')) {
log::error('"DOWNLOAD_PATH" not defined');
return array('result' => false, 'msg' => '"DOWNLOAD_PATH" not defined');
}
if (!checkDirectory(DOWNLOAD_PATH)) {
log::error('Directory ' . var_export(DOWNLOAD_PATH, true) . ' cannot be created');
return array('result' => false, 'msg' => 'Cannot create directory for downloads');
}
// DOWNLOAD YOUTUBE VIDEO
// Detect - if url is link to youtube video
if (stripos($url, 'youtube.com/') !== false || stripos($url, 'youtu.be/') !== false) {
$youtubeVideos = array();
// http://stackoverflow.com/a/10315969/2252921
preg_match('/^(?:https?:\\/\\/)?(?:www\\.)?(?:youtu\\.be\\/|youtube\\.com\\/(?:embed\\/|v\\/|watch\\?v=|watch\\?.+&v=))((\\w|-){11})(?:\\S+)?$/i', $url, $founded);
define('YoutubeVideoID', @$founded[1]);
// Set as constant YouTube video ID
if (strlen(YoutubeVideoID) == 11) {
$rawVideoInfo = file_get_contents('http://youtube.com/get_video_info?video_id=' . YoutubeVideoID . '&ps=default&eurl=&gl=US&hl=en');
if ($rawVideoInfo !== false) {
parse_str($rawVideoInfo, $videoInfo);
//var_dump($videoInfo);
if (isset($videoInfo['url_encoded_fmt_stream_map'])) {
$my_formats_array = explode(',', $videoInfo['url_encoded_fmt_stream_map']);
foreach ($my_formats_array as $videoItem) {
parse_str($videoItem, $videoItemData);
if (isset($videoItemData['url'])) {
//var_dump($videoItemData);
switch (@$videoItemData['quality']) {
case 'small':
$videoItemData['quality'] = '240p';
break;
case 'medium':
$videoItemData['quality'] = '360p';
break;
case 'large':
$videoItemData['quality'] = '480p';
break;
case 'hd720':
$videoItemData['quality'] = '720p';
break;
case 'hd1080':
$videoItemData['quality'] = '1080p';
break;
}
array_push($youtubeVideos, array('title' => trim(@$videoInfo['title']), 'thumbnail' => @$videoInfo['thumbnail_url'], 'url' => urldecode($videoItemData['url']), 'type' => @$videoItemData['type'], 'quality' => @$videoItemData['quality']));
} else {
log::error('Link to youtube source video file not exists ' . var_export($videoItemData, true));
return array('result' => false, 'msg' => 'Link to youtube source video file not exists');
}
}
} else {
$errorDescription = 'Youtube answer not contains data about video files';
if (isset($videoInfo['reason']) && !empty($videoInfo['reason'])) {
$errorDescription = trim(strip_tags($videoInfo['reason'], '<a><br/>'));
}
log::error($errorDescription . ', raw=' . var_export($rawVideoInfo, true));
return array('result' => false, 'msg' => $errorDescription);
}
} else {
log::error('Cannot call "file_get_contents()" for $url=' . var_export($url, true));
return array('result' => false, 'msg' => 'Cannot get remote content');
}
}
//var_dump($youtubeVideos);
// If we found video links
if (count($youtubeVideos) > 0) {
// Get first 'mp4' video
//.........这里部分代码省略.........