1
0
Files
helper/extend/tools/Behavior.php
2020-08-06 14:58:51 +08:00

50 lines
1.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +------------------------------------------------+
// |http://www.cjango.com |
// +------------------------------------------------+
// | 修复BUG不是一朝一夕的事情等我喝醉了再说吧 |
// +------------------------------------------------+
// | Author: 小陈叔叔 <Jason.Chen> |
// +------------------------------------------------+
namespace tools;
use think\Request;
class Behavior
{
/**
* 加载系统配置
*/
public function appBegin()
{
Config::load();
define('__SELF__', Request::instance()->url(true));
}
/**
* 定义系统常量
*/
public function moduleInit()
{
$request = Request::instance();
$method = $request->method();
define('IS_GET', $method == 'GET' ? true : false);
define('IS_POST', $method == 'POST' ? true : false);
define('IS_AJAX', $request->isAjax());
define('MODULE_NAME', $request->module());
define('CONTROLLER_NAME', $request->controller());
define('ACTION_NAME', $request->action());
}
/**
* 返回头修改
*/
public function appEnd(&$response)
{
$response->header('X-Powered-By', 'cjango.com');
}
}