本文整理汇总了PHP中log::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP log::debug方法的具体用法?PHP log::debug怎么用?PHP log::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log
的用法示例。
在下文中一共展示了log::debug方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postOrder
public function postOrder()
{
log::debug('postOrder::Input params');
log::debug(Input::all());
//Validation rules
$rules = array('pizza_marinara' => array('required', 'integer', 'between:0,3'), 'pizza_margherita' => array('required', 'integer', 'between:0,3'), 'olio' => array('min:1|max:20'), 'name' => array('required', 'min:1|max:20'), 'email' => array('required', 'email', 'min:1|max:20'), 'freeOrder' => array('exists:menu,dish'));
// The validator
$validation = Validator::make(Input::all(), $rules);
// Check for fails
if ($validation->fails()) {
// Validation has failed.
log::error('Validation has failed');
$messages = $validation->messages();
$returnedMsg = "";
foreach ($messages->all() as $message) {
$returnedMsg = $returnedMsg . " - " . $message;
}
log::error('Validation fail reason: ' . $returnedMsg);
return redirect()->back()->withErrors($validation);
}
log::debug('Validation passed');
$msg = array('email' => Input::get('email'), 'name' => Input::get('name'));
$response = Event::fire(new ExampleEvent($msg));
$response = Event::fire(new OrderCreated($msg));
return view('orderdone', ['msg' => $msg]);
}
示例2: isNonEmptyString
/**
* Tests whether provided value contains non-empty string value.
*
* Any non-string is converted to string prior to checking.
*
* @param mixed $in value to be tested
* @return string|false non-empty string value, false otherwise
*/
public static function isNonEmptyString($in)
{
if (!string::isString($in)) {
log::debug('use of non-string value');
}
$in = trim($in);
if ($in !== '') {
return $in;
}
return false;
}
示例3: vqueryf
public static function vqueryf($conn, $sql, $args = array())
{
$sql = self::generate_sql($conn, $sql, $args);
if (self::$log > 0) {
self::$log--;
log::debug($sql);
}
$result = mysql_query($sql, $conn);
if ($error = mysql_error()) {
log::error($error);
return false;
}
return $result;
}
示例4: ajaxSave
public function ajaxSave()
{
$json = file_get_contents("php://input");
log::debug('showing the json string' . $json);
$url = public_path() . "/test.json";
$fileData = json_decode(file_get_contents($url));
$fileData[] = json_decode($json);
$dataAsJson = json_encode($fileData);
file_put_contents($url, $dataAsJson);
echo '{seems to have worked ]';
// $url = urldecode($url);
//
// $file = fopen($url,'a');
//// fputs($file,PHP_EOL.'$inventory[].push('.$json.');');
// fwrite($file,$json);
// fclose($file);
}
示例5: get_youtube_data
public function get_youtube_data($v)
{
$youtube = "http://gdata.youtube.com/feeds/api/videos/" . $v . "?v=2&alt=jsonc";
$agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, $agent);
curl_setopt($curl, CURLOPT_URL, $youtube);
$return = curl_exec($curl);
log::debug($return);
return json_decode($return, true);
}
示例6: cache_file_url
/**
* Attempts to construct the full URL for the given file.
*
* Files that match a url (begin with http, ftp, or https followed by
* ://) will be returned as is.
* Files that appear to be a url (start with www.) will have the
* current scheme prepended to them.
*
* All others will be checked to see if the file exists relative to
* the document root, and the current URL directory (request came from
* http://www.mysite.com/path/two/otherfile.php then it would check
* both relative to http://www.mysite.com/path/two/ and http://www.mysite.com/.
* If the file exists and is within the document root (can't have anyone
* accessing system files using ../../ patterns) it will return the url
* to the file.
*
* If it cannot match as a URL or a valid file, it returns the passed
* file exactly as it is.
*
* Example:
* Called from - http://www.mysite.com/path/file.php
* File exists - http://www.mysite.com/css/layout.css
* File exists - /var/systemfile (/var/www being the document root)
* $file -> $return
* css/layout.css -> http://www.mysite.com/css/layout.css
* ../css/layout.css -> http://www.mysite.com/css/layout.css
* http://www.othersite.com/file.pdf -> http://www.othersite.com/file.pdf
* www.otheriste.com/file.pdf -> http://www.othersite.com/file.pdf
* ../../systemfile -> systemfile (would result it broken link)
* css/notthere.css -> css/notthere.css
*
* @param string $file
* The file to create the URL for.
*
* @return string
* The full URL of the file specified or the filename as given.
* If outside the server document root, the filename only.
*/
public static function cache_file_url($file)
{
if (preg_match('/^(http|ftp|https):\\/\\//', $file)) {
return $file;
}
if (strlen($file) > 4 && strtolower(substr($file, 0, 4)) == 'www.') {
return 'http' . (is::ssl() ? 's' : '') . '://' . $file;
}
$docroot = strtr($_SERVER['DOCUMENT_ROOT'], '\\', '/');
$self = strtr($_SERVER['PHP_SELF'], '\\', '/');
if (substr($docroot, -1) != '/') {
$docroot .= '/';
}
if (substr($self, 0, 1) == '/') {
$self = substr($self, 1);
}
$base_dir = get::dirname($docroot . $self);
if (substr($base_dir, -1) != '/') {
$base_dir .= '/';
}
if (strlen($file) > strlen($docroot) && strtolower(substr($file, 0, strlen($docroot))) == strtolower($docroot)) {
$file = substr($file, strlen($docroot));
}
//try relative (from basename of URL file, and server docroot)
if (file_exists($base_dir . $file) || file_exists($docroot . $file)) {
$path = get::realpath(file_exists($base_dir . $file) ? $base_dir . $file : $docroot . $file);
if ($path !== false && strtolower(substr($path, 0, strlen($docroot))) == strtolower($docroot)) {
//file is within the website
$self_url = self::url();
if ($self_url == null) {
define('DEBUG_URL', true);
$self_url = self::url();
log::debug($self_url);
define('URL_DEBUGGED', true);
}
$current = parse_url($self_url);
$temp = '';
if (isset($current['user']) && isset($current['pass'])) {
$temp .= sprintf('%s:%s@', $current['user'], $current['pass']);
}
$temp .= $current['host'];
if (isset($current['port'])) {
$temp .= ':' . $current['port'];
}
return $current['scheme'] . '://' . str_replace('//', '/', $temp . '/' . substr($path, strlen($docroot)));
} else {
//file is outside of the website - hacking attempt
return basename($file);
}
}
return $file;
}
示例7: add_url
/**
* 一般在 on_scan_page 和 on_list_page 回调函数中调用,用来往待爬队列中添加url
* 两个进程同时调用这个方法,传递相同url的时候,就会出现url重复进入队列
*
* @param mixed $url
* @param mixed $options
* @return void
* @author seatle <seatle@foxmail.com>
* @created time :2016-09-18 10:17
*/
public function add_url($url, $options = array())
{
// 投递状态
$status = false;
$link = array('url' => $url, 'url_type' => '', 'method' => isset($options['method']) ? $options['method'] : 'get', 'headers' => isset($options['headers']) ? $options['headers'] : array(), 'params' => isset($options['params']) ? $options['params'] : array(), 'context_data' => isset($options['context_data']) ? $options['context_data'] : '', 'proxy' => isset($options['proxy']) ? $options['proxy'] : self::$configs['proxy'], 'try_num' => isset($options['try_num']) ? $options['try_num'] : 0, 'max_try' => isset($options['max_try']) ? $options['max_try'] : self::$configs['max_try']);
if ($this->is_list_page($url) && !$this->is_collect_url($url)) {
log::debug(date("H:i:s") . " Find list page: {$url}");
$link['url_type'] = 'list_page';
$status = $this->queue_lpush($link);
}
if ($this->is_content_page($url) && !$this->is_collect_url($url)) {
log::debug(date("H:i:s") . " Find content page: {$url}");
$link['url_type'] = 'content_page';
$status = $this->queue_lpush($link);
}
return $status;
}
示例8: form
public static function form($values)
{
log::debug($values);
return '-Registered';
}
示例9: cos_debug
/**
* simple debug which write to error log if 'debug' is set in main config.ini
* Else it will not write to log file
* @param mixed $message
* @return void
*/
function cos_debug($message)
{
log::debug($message);
}
示例10: array
<?php
log::debug($_POST);
//form testing....
$form->setEchoOff(true);
echo $form->open(array('default', 'form'), array('novalidate' => 'novalidate'));
$errors = $form->getErrors();
if ($errors) {
echo '<div style="color: red;">' . implode('<br />', array_map(array('get', 'entities'), $errors)) . '</div>';
}
$name = 'dtWeek';
$v = isset($_POST[$name]) ? $_POST[$name] : '';
echo $form->week($name, $v, 'autofocus', 'required', array('datemode' => 'us', 'max' => '6/13/2013'));
echo '<br />' . $form->submit('cmdSubmit', 'Sign In');
echo $form->close();
$test = array('fe_text', 'fe_textarea', 'fe_date', 'fe_datetime', 'fe_datetimelocal', 'fe_month', 'fe_time', 'fe_number', 'fe_week');
$table = array();
$maxRows = 0;
foreach ($test as $class) {
$table[$class] = $class::acceptedAttributes();
$maxRows = max($maxRows, count($table[$class]));
}
echo '<table><tr>';
foreach ($test as $class) {
printf('<th>%s</th>', $class);
}
echo '</tr>';
for ($i = 0; $i < $maxRows; $i++) {
echo '<tr>';
foreach ($test as $class) {
printf('<td>%s</td>', isset($table[$class][$i]) ? $table[$class][$i] : ' ');
示例11: collectRegions
/**
* Maps viewports onto regions of page.
*
* This mapping is supported to improve content/view abstraction by enabling
* content of viewports being assembled into code of page's regions in a
* configurable way ...
*
* @param array $viewports content of viewports
* @return array content of regions
*/
protected function collectRegions($viewports)
{
$configs = array(config::getList('view.region'), array(array('name' => 'main', 'viewport' => array('flash', 'title', 'error', 'main')), array('name' => 'head', 'viewport' => array('header')), array('name' => 'foot', 'viewport' => array('footer', 'debug')), array('name' => 'left', 'viewport' => array('navigation')), array('name' => 'right', 'viewport' => array('aside'))));
$regions = array();
foreach ($configs as $config) {
if (is_array($config)) {
foreach ($config as $region) {
// get name of region to customize
$name = trim(@$region['name']);
if ($name === '') {
log::debug('ignoring nameless region configuration');
continue;
}
if (!array_key_exists($name, $regions)) {
// region haven't been collected before ...
if (array_key_exists('code', $region)) {
// there is a line of code containing markers selecting viewports to collect their content in current region
// e.g. "{{title}}<some-literal-content-to-insert/>{{main}}"
$regions[$name] = data::qualifyString($region['code'], $viewports);
} else {
if (is_array(@$region['viewport'])) {
// collect set of viewports named in configuration
foreach (@$region['viewport'] as $viewportName) {
$regions[$name] .= \de\toxa\txf\view::wrapNotEmpty(@$viewports[$viewportName], config::get('view.viewport.wrap.' . $viewportName, ''));
}
}
}
// support default content to show if a region keeps empty finally
if (trim($regions[$name]) === '') {
$regions[$name] = trim(@$region['default']);
}
// process any additionally contained markers
$regions[$name] = data::qualifyString($regions[$name]);
}
}
}
}
return $regions;
}
示例12: echoResult
/**
* Print work result
*
* @param (string) (data) Data for a printing
* @param (string) (type) Type of result ('json' or 'text')
* @return (bool) true
*/
function echoResult($data, $type)
{
log::debug('Returned data: ' . var_export($data, true));
$type = empty($type) ? 'json' : (string) $type;
switch ($type) {
case 'json':
if (function_exists('json_encode')) {
// since 0.1.8
echo json_encode($data);
} else {
if (class_exists('FastJSON')) {
log::debug('PHP function json_encode() is unavailable, used FastJSON class, $data=' . var_export($data, true));
echo FastJSON::encode($data);
} else {
log::error('PHP function json_encode() is unavailable and FastJSON class not exists');
die('{"status":0,"msg":"PHP function json_encode() is unavailable and FastJSON class not exists"}');
}
}
break;
case 'text':
var_dump($data);
break;
}
if (defined('DEBUG_MODE') && DEBUG_MODE) {
log::emptyLine();
}
return true;
}
示例13: handle
/**
* Handle the event.
*
* @param ExampleEvent $event
* @return void
*/
public function handle(ExampleEvent $event)
{
//
log::debug('ExampleEventHandler::handle');
log::debug($event->getMessage());
}
示例14: run_query
protected function run_query($sql, array $params = null)
{
$p = array('wt' => 'phps', 'q' => $sql);
$p['start'] = get::array_def($params, 'start', 0);
$p['rows'] = get::array_def($params, 'rows', 10);
if (isset($params) && count($params) > 0) {
$p = $p + $params;
}
$debug = false;
if (isset($p['debug_query']) && $p['debug_query']) {
unset($p['debug_query']);
$debug = true;
}
$qs = http_build_query($p, null, '&');
//$qs = preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', $qs); //kills arrays - solr doesn't handle arrays well, but does handle duplicate names
$pat = array('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '/%5E/', '/%28/', '/%29/', '/%2A/', '/%3A/', '/%22/');
$rep = array('=', '^', '(', ')', '*', ':', '"');
$qs = preg_replace($pat, $rep, $qs);
$url = $this->db . 'select?' . $qs;
if ($debug) {
log::debug($url);
}
$results = $this->runSolrQuery($url);
return $results;
}