本文整理汇总了PHP中log::setAlternativeWrite方法的典型用法代码示例。如果您正苦于以下问题:PHP log::setAlternativeWrite方法的具体用法?PHP log::setAlternativeWrite怎么用?PHP log::setAlternativeWrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log
的用法示例。
在下文中一共展示了log::setAlternativeWrite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
private function __construct($src, $debug, $request)
{
$this->_db = new DB('master');
$this->_action = $src;
$this->_request = $request;
foreach ($this->_request as $k => $v) {
switch ($k) {
case 'userid':
case 'nickname':
case 'paymentid':
case 'paymode':
$v = __paramValue('int', $v);
break;
case 'amount':
$v = __paramValue('money', $v);
break;
default:
$v = __paramValue('string', $v);
}
$this->_request[$k] = $v;
}
// if ($debug) {
$this->_log = new log('onlinedengi/income-%d%m%Y.log', 'a', '%d.%m.%Y %H:%M:%S : ' . self::$req_descr[$this->_action] . ' : ');
$this->_log->addAlternativeMethodSave(new log_pskb(), true);
$alt_out = array('param' => self::$req_descr[$this->_action], 'response' => $this->_request);
$this->_log->setAlternativeWrite(serialize($alt_out), 'log_pskb');
// $dbg = var_export($this->_request, true);
$this->_log->writevar($this->_request);
// }
}
示例2: _request
protected function _request($method, $params, $content_plain = false, $query_params = array('method' => 'POST'))
{
$ch = curl_init();
$str_method = strtolower($method);
$cp1251_params = $params;
if (is_array($params)) {
foreach ($params as $k => $v) {
$params[$k] = $this->_enc($v);
}
} else {
$params = $this->_enc($params);
}
if ($query_params['method'] == 'GET') {
$method .= (defined('PSKB_TEST_MODE') ? "&" : "?") . http_build_query($params);
}
if (defined('PSKB_BETA_MODE')) {
curl_setopt($ch, CURLOPT_PORT, 8085);
curl_setopt($ch, CURLOPT_URL, "http://localhost/apiLCPlace/" . $method);
} else {
if (!defined('PSKB_TEST_MODE')) {
curl_setopt($ch, CURLOPT_PORT, 8085);
curl_setopt($ch, CURLOPT_URL, 'http://192.168.88.13/apiLCPlace/' . $method);
// curl_setopt($ch, CURLOPT_URL, "http://localhost/apiLCPlace/" . $method);
} else {
if (defined('BASIC_AUTH')) {
curl_setopt($ch, CURLOPT_USERPWD, BASIC_AUTH);
}
curl_setopt($ch, CURLOPT_URL, $this->_request_url . $method);
}
}
if ($query_params['method'] == 'POST') {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
}
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
if ($content_plain) {
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
}
$res = curl_exec($ch);
$log = new log("pskb/{$str_method}-" . SERVER . '-%d%m%Y.log', 'a', '%d.%m.%Y %H:%M:%S : ');
if ($this->_useAlternativeLog) {
$log->addAlternativeMethodSave(new log_pskb(), true);
$alt_out = array('request_url' => $this->_request_url . $method, 'param' => $cp1251_params, 'response' => iconv('utf8', 'cp1251', $res));
$log->setAlternativeWrite(serialize($alt_out), 'log_pskb');
}
ob_start();
var_dump($this->_request_url . $method);
var_dump($params);
var_dump($res);
$out = ob_get_clean();
$log->writeln(iconv('utf8', 'cp1251', $out));
return $res;
}