本文整理汇总了PHP中Response::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::instance方法的具体用法?PHP Response::instance怎么用?PHP Response::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Response
的用法示例。
在下文中一共展示了Response::instance方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* Returns an instance of Request object
* @return Request
*/
public static function getInstance()
{
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
示例2: getInstance
public static function getInstance()
{
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
示例3: getInstance
/**
* @return Response
*/
public static function getInstance()
{
if (!self::$instance instanceof Response) {
self::$instance = new Response();
}
return self::$instance;
}
示例4: getInstance
/**
* получаем экземпляр объекта
* необходим при испоьзовании HMVC
*
*/
function getInstance($redirect_if_not_ajax = TRUE)
{
if (is_null(self::$instance)) {
self::$instance = new Response($redirect_if_not_ajax);
}
return self::$instance;
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->parent_nav_active = 'manage';
$this->child_nav_active = 'collect';
$this->grandchild_nav_active = 'collect';
$this->rsp = Response::instance();
}
示例6: getInstance
/**
* @static
* @return Response
*/
public static function getInstance()
{
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c();
}
return self::$instance;
}
示例7: exec
public function exec()
{
$class_name = 'Resource_' . str_replace('/', '_', $this->get_resource());
$class = new ReflectionClass($class_name);
$resource = $class->newInstance($this);
$class->getMethod('before')->invoke($resource);
$class->getMethod($this->request_method)->invoke($resource);
$class->getMethod('after')->invoke($resource);
$response = Response::instance();
$response->set_body($resource->get_data());
return $response;
}
示例8: __construct
public function __construct()
{
parent::__construct();
$this->parent_nav_active = 'manage';
$this->active_tag = isset($_GET['tag']) ? $_GET['tag'] : 'all';
$this->publish = isset($_GET['publish']) ? $_GET['publish'] : NULL;
$this->active_rating = isset($_GET['rating']) ? $_GET['rating'] : 'all';
$this->active_range = isset($_GET['range']) ? $_GET['range'] : 'all';
$this->active_page = (isset($_GET['page']) and is_numeric($_GET['page'])) ? $_GET['page'] : 1;
$this->testimonial_id = isset($_GET['id']) ? valid::id_key($_GET['id']) : NULL;
# prep the ajax response
$this->rsp = Response::instance();
}
示例9: change_password
public function change_password()
{
if (!$_POST) {
die;
}
$old_pw = $_POST['old_pw'];
$salt = $this->auth->find_salt($this->owner->password);
$old_pw = $this->auth->hash_password($old_pw, $salt);
$this->rsp = Response::instance();
if ($old_pw == $this->owner->password) {
$this->owner->password = $_POST['new_pw'];
$this->owner->save();
$this->rsp->status = 'success';
$this->rsp->msg = 'Password Changed!';
$this->rsp->send();
}
$this->rsp->msg = 'Invalid Password!';
$this->rsp->send();
}
示例10: __construct
public function __construct()
{
parent::__construct();
$this->parent_nav_active = 'display';
$this->rsp = Response::instance();
}
示例11: define
<?php
define('DS', DIRECTORY_SEPARATOR);
define('APP_PATH', dirname(__FILE__) . DS);
define('SYS_PATH', realpath(dirname(__FILE__) . DS . '..' . DS . 'system') . DS);
define('RESOURCE_PATH', dirname(__FILE__) . DS . 'classes' . DS . 'resource' . DS);
require SYS_PATH . 'classes' . DS . 'resty' . DS . 'core.php';
require SYS_PATH . 'classes' . DS . 'resty.php';
Resty::instance()->init();
try {
Request::instance()->exec()->output();
} catch (Route_Exception $e) {
Response::instance()->set_status(404)->set_body(array('error' => 'Resource Not Found', 'Request' => $_SERVER['REQUEST_URI']))->output();
}