ThinkPHP thinkphp5 tp5 SAE conf.yaml 配置

 

自动生成MVC结构  php think build --module index

 

namespace app\index\controller;
use think\Controller;

class Index extends controller
{
    public function index()
    {
       return $this->fetch();
    }
}

 

'view_replace_str'  =>  [
    '__PUBLIC__'=>'/public/',
    '__ROOT__' => '/',
]

ThinkPHP5 tp5 SAE conf.yaml 配置:
- rewrite: if(%{REQUEST_URI}~"^/(.*)$" && %{REQUEST_URI}!~"^/public(.*)$") goto "/public/%1" 
- rewrite: if(!-f && path~"^/public/(.*)$") goto "/public/index.php/$1"

 在database.php中加入:

return [
// 数据库类型
'type'        => 'mysql',
// 服务器地址
'hostname'    => SAE_MYSQL_HOST_M . ',' . SAE_MYSQL_HOST_S,
// 数据库名
'database'    => SAE_MYSQL_DB,
// 用户名
'username'    => SAE_MYSQL_USER,
// 密码
'password'    => SAE_MYSQL_PASS,
// 端口
'hostport'    => SAE_MYSQL_PORT,
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) 
'deploy' => 1, 
    
];

在config.php中加入:

'log'       =>  [
    'type'  => '\think\sae\Log',
],

'template'  =>  [
    'type'          =>  'Think',
    'compile_type'  =>  '\think\sae\Template',
],

'cache'     =>  [
    'type'  =>  '\think\sae\Cache',
]

 

posted @ 2016-12-09 12:03  WilliamShaw  阅读(912)  评论(0编辑  收藏  举报