Giter Club home page Giter Club logo

think-sae's Introduction

ThinkPHP 5.0 SAE扩展

添加下面的配置参数即可

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

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

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

数据库配置文件database.php中修改为:

// 数据库类型
'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,

think-sae's People

Contributors

c0refast avatar lilwil avatar liu21st avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

think-sae's Issues

sae 支持 thinkphp5 已解决

修改 thinkphp\library\think\Template.php 大约 79 行:
// 初始化模板编译存储器
// $type = $this->config['compile_type'] ? $this->config['compile_type'] : 'File';
$type = Config::get('template.compile_type')? Config::get('template.compile_type'):$this->config['compile_type'];

为大家指条明路吧,这个sae扩展的使用方法见内

我们都知道程序界有一个不好的现象就是好读的文档很少,所以后进者们像啃天书一样看文档,其根本原因就是前辈们站的高,他觉得既然他能站这么高,那么别人也能轻松站这么高,所以文档随便写写就行了。所以害苦了后进者。

这个sae扩展的真正使用方法见下:

1、src里面的三个文件存哪里:如果你用composer的话,你不用关心存到哪里,但是你手动下载的话,你就懵逼了,该放哪呢?放到\thinkphp\library\think覆盖源文件么?并不是。其实是在这个目录里再创建sae文件夹,然后把三个文件放里面。不用composer的话,神他妈才能猜出来需要创建sae文件夹然后放里面。

2、不知道添加参数是在哪添加?一般是跟application\config.php里添加。

3、怎么添加?直接粘进去?当然不是。覆盖现有参数?也不可以,因为覆盖了之后你本地环境怎么测试呢?所以优雅一点就是入口index.php里加一行define("IS_SAE", defined("SAE_MYSQL_USER")); 这样如果SAE环境,IS_SAE就为true了。

然后修改config.php,把'type' => 'File'改成'type' => IS_SAE ? '\think\sae\Log' : 'File'就好啦。其他几个参数也类似这么干就可以了。

4、database.php怎么改?直接覆盖?当然不可以!因为要照顾本地测试环境。所以,用if (IS_SAE) {} else {}来return两套配置,就好了。

相信我,官方文档不会这么详细的,而且你提问也没人回答你的,我提问完没人搭理我,看文档又看不懂,最后还是自己摸索出来一套办法。

可笑啊。

在SAE环境下如何隐藏TP目录呢?

不知道SAE能不能指定WEB根目录
我现在是改了[config.yaml]

handle:

  • rewrite: if(!is_dir() && !is_file() && path~"^(.*)$") goto "public/index.php/$1"

然后其余的文件加进了黑名单
有没有更好的解决方案呢?

顺便占个板凳 支持这个项目

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.