pachel / easyframework
此软件包最新版本(1.0.0)没有提供许可信息。
Easy Framework
1.0.0
2024-01-15 20:41 UTC
Requires
- php: >=7.4
- ext-pdo: *
Requires (Dev)
- phpunit/phpunit: ^9.6
This package is auto-updated.
Last update: 2024-09-13 10:01:33 UTC
README
klasj dlkasjdlkjasdél kj
asjdh kjash dkjash jkdh ashd
jash dkjash djk
- asdasdasdas
- asdasdasd
- asdasdasd
基本用法
<?php
use Pachel\EasyFrameWork\Base;
require_once __DIR__."/../vendor/autoload.php";
$config = [
"APP" => [
"URL" => "https:///easyframe/examples/",
"UI" => __DIR__."/../UI/",
"VIEWs" => __DIR__."/../UI/views/",
"LOGS" => __DIR__."/../logs/"
]
];
$App = Base::instance();
$App->config($config);
//Loads the template.html file from the folder APP.VIEWS to any get request
$App->Routing()->get("*")->view("index.html");
$App->run();
?>
配置
必需参数
- APP
- URL
- UI
如果未设置 APP.VIEW 文件夹,则应用程序将在 APP.UI 文件夹中寻找模板
推荐
- APP
- VIEWS
- LOGS
使用说明
示例1
$config = [
"APP" => [
"URL" => "https://",
"UI" => "UI FOLDER"
]
];
$App->config($config);
示例2
config.php
//Content of your config file
<?php
return [
"APP" => [
"URL" => "https://",
"UI" => "UI FOLDER"
]
];
index.php
<?php
$App->config("Your config file's path");
如何访问配置文件数据?
//From everywhere
Base::instance()->env("APP.URL");
//From text/html code
{{APP.URL}}
//From php code
echo $APP["URL"];
路由
应使用Routes类创建路由,但必须在设置 cofig 之后进行!!
路由到 _GET 方法
//http://yourdomain/
$Routing = Routes::instance();
$Routing->get("/")->view("index.html");
路由到 _POST 方法
//http://yourdomain/
$Routing->post("/")->view("index.html");
路由到任何方法
//http://yourdomain/
$Routing->postget("/")->view("index.html");
post()、get()、postget()、cli()的参数
$path
asdasd