top-think / think-sae Goto Github PK
View Code? Open in Web Editor NEWsae support for thinkphp5
License: Apache License 2.0
sae support for thinkphp5
License: Apache License 2.0
我们都知道程序界有一个不好的现象就是好读的文档很少,所以后进者们像啃天书一样看文档,其根本原因就是前辈们站的高,他觉得既然他能站这么高,那么别人也能轻松站这么高,所以文档随便写写就行了。所以害苦了后进者。
这个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两套配置,就好了。
相信我,官方文档不会这么详细的,而且你提问也没人回答你的,我提问完没人搭理我,看文档又看不懂,最后还是自己摸索出来一套办法。
可笑啊。
composer 包也没更新
调用也各种报错
不知道SAE能不能指定WEB根目录
我现在是改了[config.yaml]
handle:
然后其余的文件加进了黑名单
有没有更好的解决方案呢?
顺便占个板凳 支持这个项目
composer2.0版本找不到https://packagist.org/packages/topthink/think-sae#dev-master
修改 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'];
大神,问两个问题:
1、“添加下面的配置参数”是在哪个文件添加?
2、如果修改了database.php的配置,当在本地测试的时候怎么办?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.