本文整理汇总了PHP中kernel::strip_magic_quotes方法的典型用法代码示例。如果您正苦于以下问题:PHP kernel::strip_magic_quotes方法的具体用法?PHP kernel::strip_magic_quotes怎么用?PHP kernel::strip_magic_quotes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kernel
的用法示例。
在下文中一共展示了kernel::strip_magic_quotes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_rpc
private function process_rpc()
{
ignore_user_abort();
set_time_limit(0);
$process_id = $this->gen_uniq_process_id();
header('Process-id: ' . $process_id);
header('Connection: close');
flush();
if (get_magic_quotes_gpc()) {
kernel::strip_magic_quotes($_REQUEST);
}
base_logger::begin(__FUNCTION__);
set_error_handler(array(&$this, 'user_error_handle'), E_USER_ERROR);
$this->start_time = $_SERVER['REQUEST_TIME'] ? $_SERVER['REQUEST_TIME'] : time();
list($service, $method, $params) = $this->parse_rpc_request($_REQUEST);
$data = array('network' => $this->network, 'method' => $service, 'calltime' => $this->start_time, 'params' => $request->params, 'type' => 'response', 'process_id' => $process_id, 'callback' => $_SERVER['HTTP_CALLBACK']);
app::get('base')->model('rpcpoll')->insert($data);
$object = kernel::service($service);
$result = $object->{$method}($params, $this);
$output = base_logger::end();
$result_json = array('rsp' => 'succ', 'data' => $result, 'res' => strip_tags($output));
$connection_aborted = $this->connection_aborted();
if ($connection_aborted) {
app::get('base')->model('rpcpoll')->update(array('result' => $result), array('process_id' => $process_id, 'type' => 'response'));
if ($_SERVER['HTTP_CALLBACK']) {
$return = kernel::single('base_httpclient')->get($_SERVER['HTTP_CALLBACK'] . '?' . json_encode($result_json));
$return = json_decode($return);
if ($return->result == 'ok') {
app::get('base')->model('rpcpoll')->delete(array('process_id' => $process_id, 'type' => 'response'));
}
}
} else {
app::get('base')->model('rpcpoll')->delete(array('process_id' => $process_id, 'type' => 'response'));
}
echo json_encode($result_json);
}
示例2: process_rpc
private function process_rpc()
{
ignore_user_abort();
set_time_limit(0);
$this->process_id = $this->gen_uniq_process_id();
header('Process-id: ' . $this->process_id);
header('Connection: close');
flush();
if (get_magic_quotes_gpc()) {
kernel::strip_magic_quotes($_REQUEST);
}
if (strtolower($_SERVER['HTTP_CONTENT_ENCODING']) == 'gzip') {
$_input = fopen('php://input', 'rb');
while (!feof($_input)) {
$_post .= fgets($_input);
}
fclose($_input);
$_post = utils::gzdecode($_post);
parse_str($_post, $post);
if ($post) {
if (get_magic_quotes_gpc()) {
kernel::strip_magic_quotes($_GET);
}
$_REQUEST = array_merge($_GET, $post);
}
}
//todo: uncompress post data
$this->begin(__FUNCTION__);
set_error_handler(array(&$this, 'error_handle'), E_ERROR);
set_error_handler(array(&$this, 'user_error_handle'), E_USER_ERROR);
$this->start_time = $_SERVER['REQUEST_TIME'] ? $_SERVER['REQUEST_TIME'] : time();
list($service, $method, $params) = $this->parse_rpc_request($_REQUEST);
$data = array('id' => $_REQUEST['task'], 'network' => $this->network, 'method' => $service, 'calltime' => $this->start_time, 'params' => $params, 'type' => 'response', 'process_id' => $this->process_id, 'callback' => $_SERVER['HTTP_CALLBACK']);
$obj_rpc_poll = app::get('base')->model('rpcpoll');
// 防止多次重刷.
if (!$obj_rpc_poll->db->select('SELECT id FROM ' . $obj_rpc_poll->table_name(1) . ' WHERE id=\'' . $_REQUEST['task'] . '\' AND type=\'response\' LIMIT 0,30 LOCK IN SHARE MODE')) {
$obj_rpc_poll->insert($data);
$object = kernel::service($service);
$result = $object->{$method}($params, $this);
$output = $this->end();
} else {
$output = $this->end();
$output = app::get('base')->_('该请求已经处理,不能在处理了!');
}
$result_json = array('rsp' => 'succ', 'data' => $result, 'res' => strip_tags($output));
$this->rpc_response_end($result, $this->process_id, $result_json);
echo json_encode($result_json);
}
示例3: process_rpc
private function process_rpc()
{
ignore_user_abort();
set_time_limit(0);
$this->process_id = $this->gen_uniq_process_id();
header('Process-id: ' . $this->process_id);
header('Connection: close');
flush();
if (get_magic_quotes_gpc()) {
kernel::strip_magic_quotes($_REQUEST);
}
if (strtolower($_SERVER['HTTP_CONTENT_ENCODING']) == 'gzip') {
$_input = fopen('php://input', 'rb');
while (!feof($_input)) {
$_post .= fgets($_input);
}
fclose($_input);
$_post = utils::gzdecode($_post);
parse_str($_post, $post);
if ($post) {
if (get_magic_quotes_gpc()) {
kernel::strip_magic_quotes($_GET);
}
$_REQUEST = array_merge($_GET, $post);
}
}
//todo: uncompress post data
$this->begin(__FUNCTION__);
set_error_handler(array(&$this, 'error_handle'), E_ERROR);
set_error_handler(array(&$this, 'user_error_handle'), E_USER_ERROR);
$this->start_time = $_SERVER['REQUEST_TIME'] ? $_SERVER['REQUEST_TIME'] : time();
list($service, $method, $params) = $this->parse_rpc_request($_REQUEST);
$data = array('apilog' => $_REQUEST['task'], 'calltime' => $this->start_time, 'params' => $params, 'api_type' => 'response', 'msg_id' => $this->process_id, 'method' => $service, 'worker' => $service . ":" . $method);
$obj_rpc_poll = app::get('apiactionlog')->model('apilog');
// 防止多次重刷.
if (!$obj_rpc_poll->db->select('SELECT apilog_id FROM ' . $obj_rpc_poll->table_name(1) . ' WHERE apilog=\'' . $_REQUEST['task'] . '\' AND api_type=\'response\' LIMIT 0,30 LOCK IN SHARE MODE')) {
//记录apilog
$apilog_services = kernel::single('apiactionlog_router_logging');
$apilog_services->save_log($service, $method, $data);
$api_module = app::get('base')->getConf($service . '.' . $method);
if (isset($api_module['function'])) {
$object = kernel::single($api_module['class']);
$result = $object->{$method}($params, $this);
$output = $this->end();
} else {
$output = $this->end();
$msg = 'ECstore中不存在' . $_REQUEST['method'] . '接口';
$output = app::get('base')->_($msg);
$status = 'fail';
}
} else {
$output = $this->end();
$output = app::get('base')->_('该请求已经处理,不能在处理了!');
}
$result_json = array('rsp' => $status ? $status : 'succ', 'data' => $result, 'res' => strip_tags($output));
$this->rpc_response_end($result, $this->process_id, $result_json);
echo json_encode($result_json);
}