composer create-project zxwqxtu/flyphp {project} dev-master
支持mysql,pgsql等关系型数据库(pdo), mongodb
支持自定义url rewrite
return [
'/blog' => '/test/index/blog' //用/blog 代替test/index/blog访问
];
$this->view='test/index',则表示views/test/index.php
$this->layout='index',则表示layout/index.php
$this->theme = 'new',则表示layout/new/index.php
php web/index.php {controller} {action} {param1} {param2}...
-
每个action不能有exit,die等中途退出,必须用return 返回值。
-
网页访问, 返回值在view中展示
-
命令行访问, 返回值如果是对象数组,就json输出,否则直接echo,命令行不会执行view层
-
protected $dbType = 'mysql';
protected $dbSelect= 'default';
protected $table = '';
protected $collection = '';
find($id)
findAll()
findBy($where)
findOneBy($where)
pdo [['id', 13], ['status', [0,1]], ['date', '20150503', '>']] mongodb 原始格式
server {
listen 9090;
root /www/web/flyPhp2/web;
index index.php;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /index.php$request_uri;
}
location ~ \.php {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
error_log logs/flyphp2.error.log;
access_log logs/flyphp2.access.log;
}