wallrio / directly
快速提供网页的微框架
1.0.0
2019-08-27 13:41 UTC
Requires
- php: >=5.3.2
README
用于快速提供网页的PHP微框架
安装
建议您使用Composer来安装Directly。
$ composer require wallrio/directly "*"
用法
创建一个包含以下内容的index.php文件
<?php require 'vendor/autoload.php'; use directly\Directly as Directly; $directly = new Directly('application'); $directly->run('/');
创建一个包含以下内容的.htaccess文件
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php [L]
</IfModule>
Class Directly()
-
new Directly(DIRECTORY-YOUR-APP);
DIRECTORY-YOUR-APP = specifies the application directory (optional)
-
$directly->run(ROUTE);
ROUTE = specifies an initial route (optional)
-
可选地,您可以强制为文件指定一个主目录,使用以下属性来完成此操作
$directly->publicDir = 'DIRECTORY-PUBLIC';
DIRECTORY-PUBLIC = specify a directory after the directory of your application
示例
$directly->publicDir = 'assets';
结构目录
/your-directory-project
|
|--application/
| |
| |--error
| | |--404
| | |--view.php
| |
| |--global
| | |--header.php
| | |--footer.php
| |
| |--inc
| | |--menu.php
| |
| |--view
| |--home
| |--view.php
| |--about
| |--view.php
| |--contact
| |--view.php
|
|--- .htaccess
|--- index.php
其他选项
$directly->publicDir = 'assets';
短标签
[=inc:menu.php=] = includes no document the contents of the menu.php file located in the directory /application/inc
[=inc-route:meta.php=] = includes no document the contents of the menu.php file located in the directory /application/view/CURRENT-PAGE/meta.php
[=global:FILE_NAME=] = includes no document the contents of the menu.php file located in the directory /application/global/FILE_NAME.php
[=domain:url=] = replace to url of domain
许可证
Directly框架遵循MIT许可证。有关更多信息,请参阅许可证文件。