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中加入: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中加入:mysql

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

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

'cache'     =>  [
    'type'  =>  '\think\sae\Cache',
]
相關文章
相關標籤/搜索