本文整理汇总了PHP中response::send方法的典型用法代码示例。如果您正苦于以下问题:PHP response::send方法的具体用法?PHP response::send怎么用?PHP response::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类response
的用法示例。
在下文中一共展示了response::send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* 入口点
*/
function run()
{
$response = new response();
$cacheConfig = config('cache');
if ($cacheConfig['cache']) {
$cache = cache::getInstance($cacheConfig);
$content = $cache->check($this->http->url());
if (!empty($content)) {
$response->setBody($content);
$response->send();
}
}
try {
$handler = $this->parseUrl();
if (is_array($handler)) {
list($control, $action) = $handler;
$path = ROOT . '/application/control/' . $control . '.php';
if (file_exists($path)) {
include $path;
$class = 'application\\control\\' . $control . 'Control';
if (class_exists($class)) {
//$class = new \ReflectionClass($class);
$class = new $class();
$class->response =& $response;
if (method_exists($class, $action) && is_callable(array($class, $action)) || method_exists($class, '__call')) {
$response->setCode(200);
$response->setBody($this->__200($class, $action));
} else {
$response->setCode(404);
$response->setBody($this->__404($control, $action));
}
} else {
$response->setCode(404);
$response->setBody($this->__404($control, $action));
}
} else {
$response->setCode(404);
$response->setBody($this->__404($control, $action));
}
} else {
include ROOT . '/application/thread/' . $handler . '.php';
$class = 'application\\thread\\' . $handler . 'Thread';
$class = new $class();
$class->run();
}
} catch (\Exception $e) {
$response->setCode(500);
$response->setBody($this->__500($e));
} finally {
$response->send();
}
}
示例2: sys_sync
/**
* System interfaces syncronization
* @access protected
*/
protected function sys_sync()
{
// Сбросить со всех записей признака проверен (поле check)
$this->_flush();
$this->insert_on_empty = false;
$this->push_args(array('exist' => 0, '_sexist' => 1));
$this->_set();
$this->pop_args();
$ep = data_interface::get_instance('entry_point');
$interfaces = array('ui' => $this->get_di_array(), 'di' => $this->get_ui_array());
$ep->register($interfaces);
// Удаляем все ТВ, которые в процессе синхронизации не были отмечены как существующие
$this->_flush();
$this->insert_on_empty = false;
$this->push_args(array('_sexist' => 0));
$this->_unset();
// Получаем массив ID удалённых записей и удаляем их из таблицы связей с группами
$epg = data_interface::get_instance('entry_point_group');
$ids = (array) $this->get_lastChangedId();
foreach ($ids as $id) {
$epg->remove_entry_point_from_groups($id);
}
$this->pop_args();
response::send(array('success' => true), 'json');
}
示例3: sys_public
/**
* Get UI entry point
*/
protected function sys_public()
{
$this->_flush(true);
$this->connector->fetchMethod = PDO::FETCH_ASSOC;
$in = $this->join_with_di('interface', array('interface_id' => 'id'), array('name' => 'interface_name'));
$this->what = array('SUBSTRING(`' . $this->get_alias() . '`.`name`, 5)' => 'name', 'human_name');
$this->set_args(array('_sname' => 'pub_%'), true);
response::send($this->_get(), 'json');
}
示例4: request
public function request()
{
$reponse = new response();
if (user::authorization()) {
$reponse->authorization(true);
try {
$request = new request($_SERVER['REQUEST_URI'], $_SERVER['REQUEST_METHOD']);
call_user_func_array(array($reponse, 'set_content'), $request->getResponse());
// send Request and set_content in response
} catch (ExceptionTodoList $e) {
$reponse->set_content('404', $e->getMessage(), null);
echo $reponse->send();
exit;
}
} else {
$reponse->set_content('401', errorApi::AUTHENTICATION_ERR, null);
}
echo $reponse->send();
}
示例5: admin
/**
* Форма фхода в админку
* @access protected
*/
public function admin()
{
$args = request::get(array('user', 'secret'));
$data = array('LC' => LC::get());
try {
if (!empty($args)) {
authenticate::login();
}
} catch (Exception $e) {
dbg::write($e->getMessage(), LOG_PATH . 'adm_access.log');
$data['errors'] = $e->getMessage();
}
if (!authenticate::is_logged()) {
$tmpl = new tmpl($this->pwd() . 'login.html');
response::send($tmpl->parse($data), 'html');
} else {
response::redirect('/xxx/');
}
}
示例6: sys_remove_interfaces_from_group
/**
* Remove interfaces from group
* @access protected
*/
protected function sys_remove_interfaces_from_group()
{
//dbg::write($this->get_args());
$success = true;
$gid = $this->get_args('gid');
$iids = split(',', $this->get_args('iids'));
if (!empty($iids) && $gid > 0) {
foreach ($iids as $iid) {
$this->_flush();
$this->set_args(array('_siid' => $iid, '_sgid' => $gid));
$this->_unset();
}
} else {
$success = false;
}
response::send(array('success' => $success), 'json');
}
示例7: sys_interfaces
/**
* ExtJS Grid of available entry points
*/
protected function sys_interfaces()
{
$tmpl = new tmpl($this->pwd() . 'interfaces.js');
response::send($tmpl->parse($this), 'js');
}
示例8: sys_mset
/**
* Сохранить данные и вернуть JSON-пакет для ExtJS
* @access protected
*/
protected function sys_mset()
{
$records = (array) json_decode($this->get_args('records'), true);
foreach ($records as $record) {
$record['_sid'] = $record['id'];
unset($record['id']);
$this->_flush();
$this->push_args($record);
$this->insert_on_empty = true;
$data = $this->extjs_set_json(false);
$this->pop_args();
}
response::send(array('success' => true), 'json');
}
示例9: sys_unset
/**
* Unset data to storage and return results in JSON
* @access protected
*/
protected function sys_unset()
{
$this->_flush();
$data = $this->extjs_unset_json(false);
// Remove all links between users and deleted groups
$gu = data_interface::get_instance('group_user');
$epg = data_interface::get_instance('entry_point_group');
$ids = (array) $this->get_lastChangedId();
foreach ($ids as $gid) {
$gu->remove_users_from_group($gid);
$epg->remove_entry_points_from_group($gid);
}
response::send($data, 'json');
}
示例10: sys_main
/**
* Управляющий JS админки
*/
protected function sys_main()
{
$tmpl = new tmpl($this->pwd() . 'help.js');
response::send($tmpl->parse($this), 'js');
}
示例11: sys_remove_users_from_group
/**
* Remove users from group
* @access protected
*/
protected function sys_remove_users_from_group()
{
//dbg::write($this->get_args());
$success = true;
$gid = $this->get_args('gid');
$uids = explode(',', $this->get_args('uids'));
if (!empty($uids)) {
foreach ($uids as $uid) {
$this->_flush();
$this->set_args(array('_suid' => $uid, '_sgid' => $gid));
$this->_unset();
}
} else {
$success = false;
}
response::send(array('success' => $success), 'json');
}
示例12: catch
<?php
/**
* The user interface initialization code
*
* @author Litvinenko S. Anthon <crazyfluger@gmail.com>
* @version 2.0
* @access public
* @package CFsCMS2(PE)
*/
try {
// Call user interface
$ui = user_interface::get_instance(request::get('ui', UI_DEFAULT));
if (($content = $ui->call(request::get('cll'), request::get())) === FALSE) {
response::header('404');
} else {
response::send($content, 'html');
}
} catch (Exception $e) {
dbg::write($e->getMessage(), LOG_PATH . 'ui_errors.log');
//response::header('404');
//9* 28102010
$out = user_interface::get_instance('action_page');
$out->set_args(array('action_msg' => $e->getMessage()));
return $out->render();
}
示例13: sys_browser
protected function sys_browser()
{
$tmpl = new tmpl($this->pwd() . 'file_browser.html');
response::send($tmpl->parse($this), 'html');
}
示例14: sys_unset
/**
* Удалить узел
* @access protected
*/
protected function sys_unset()
{
$id = intval($this->args['_sid']);
$ns = new nested_sets($this);
if ($id > 0 && $ns->delete_node($id)) {
$data = array('success' => true);
} else {
$data = array('success' => false);
}
response::send($data, 'json');
}
示例15: catch
<?php
/**
* The data interface initialization code
*
* @author Litvinenko S. Anthon <crazyfluger@gmail.com>
* @version 2.0
* @access public
* @package SBIN Diesel
*/
try {
// NOTE: If defined authentication data interface and user not logged in
/* 9* старый вариант не рубил отдачу файлов по сслке /files/?id=6 например в случае если юзер не залогинен
и вот потому дополнительно условие если аутх мое публик то на pub_ не будем руибить доступ ибо это публик по дефолту
if (defined('AUTH_DI') && !authenticate::is_logged())
*/
if (defined('AUTH_DI') && !authenticate::is_logged() && AUTH_MODE != 'public') {
// Then send error
response::send('Session closed. Authorization needed.', 'error');
}
$di = data_interface::get_instance(request::get('di'));
// If return FALSE then access denied
if (!$di->call(request::get('cll'), request::get())) {
response::send('Access denied.', 'error');
}
} catch (Exception $e) {
dbg::write("UID: " . UID . "\nREQUEST_URI: {$_SERVER['REQUEST_URI']}\n" . $e->getMessage() . "\n" . $e->getTraceAsString(), LOG_PATH . 'di_errors.log');
response::send('Error while process request.', 'error');
}