本文整理汇总了PHP中Command::set_result方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::set_result方法的具体用法?PHP Command::set_result怎么用?PHP Command::set_result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command
的用法示例。
在下文中一共展示了Command::set_result方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$ap_name = Buffer::get(URL_AP);
$controller_name = Buffer::get(URL_CONTROLLER);
$query_param = Buffer::get(self::QUERY_PARAM, 'post');
$command = Buffer::get('command', 'post');
$client_format = Buffer::get('format', 'post');
$action = Buffer::get('action', 'post');
$access_zone = config(URL_AP, 'access', 'zone');
$server_format = config('settings', 'web_format');
if ($client_format != $server_format) {
throw new Exception_wx(4060002, $client_format);
}
$command = Security::sanitize_string($command);
$action = Security::sanitize_string($action);
$command_path = APPPATH . 'commands/' . "{$ap_name}/{$command}" . EXT;
if (!file_exists($command_path)) {
$command_path = APPPATH . "modules/{$ap_name}/{$controller_name}/commands/{$command}" . EXT;
}
if (!file_exists($command_path)) {
throw new Exception_wx(4040000, $command_path);
}
if ($access_zone != Z_PUBLIC and !Security::check_signature(Buffer::get_post('sig'))) {
throw new Exception_wx(4030001);
}
include_once $command_path;
if (!class_exists($action)) {
throw new Exception_wx(4040002, $command_path, $action);
}
$query_param = Format::converter($query_param, $server_format, TRUE);
$command_object = new $action($query_param);
if (!is_a($command_object, self::COMMAND_CLASS)) {
throw new Exception_wx(5000002, $command_path, $command_object);
}
$command_object->set_module(Buffer::get(URL_CONTROLLER));
try {
$command_object->execute();
} catch (Command_exception $exc) {
Command::set_result(FALSE);
$message =& $exc->client_message;
if (!empty($message)) {
$options = array('message' => $message, 'type' => 'error');
Command::set_client_command('show_message', $options);
}
Log::log_error($exc, 'command_exception');
$this->_to_client();
}
if (!Command::isset_result()) {
Command::set_result(TRUE);
}
$this->_to_client();
}