geeknection/buuhvframework

使用 BuuhV 框架轻松创建您的 PHP 应用程序

1.0.1 2020-04-10 23:58 UTC

This package is auto-updated.

Last update: 2024-09-13 18:39:22 UTC


README

文档

composer create-project geeknection/buuhvframework

使用 BuuhV 框架轻松创建您的 PHP 应用程序

文件夹结构

app/views/pages - 它包含您的视图页面。例如:home/index.html
app/views/components - 它包含您的组件页面。例如:sidebar.html
app/views/layout - 它包含您的 CSS、JS 或图像文件设计依赖

app/controllers/ - 它包含您的应用程序控制器。例如:home/index.php
app/models/ - 它包含您的控制器模型。例如:home/index.php

texts/ - 它包含您的语言文件。例如:texts/en-us.txt

我如何构建我的应用程序?

在 App 文件夹中,您有控制器、模型和视图。
页面位于 views 文件夹中
控制器位于 controllers 文件夹中
模型位于 models 文件夹中。

如何构建视图?

app 文件夹中创建类似这样的: view-name/index.html
然后在该文件夹内构建页面模板

如何构建路由?

在您的 app 文件夹中打开 index.php 文件,并在 Routes::notFound() 之前编写
"Routes::set('/your-route-name, function() {
//这里您将获取您的视图
View::build('view-name');
}"

我如何在 html 文件中定义 css、js 或图像文件?

layout 文件夹内

我如何导入路径布局文件?

在您的视图文件中使用 "echo App::layout ('file-path-in-folder');"

我如何在 html 文件中定义值?

在您的 html 文件内写入类似这样的内容: {{variableName}} 当您调用 View::build... 时,您需要编写 View::build('view-name', array( 'variableName' => variable-value ));

我如何翻译我的应用程序?

Lang::translate('text-slug');
在 texts 文件夹内创建您的语言文件。例如:texts/en-us.txt

我如何使用 rest 服务 api?

当您向您的服务器发送请求时,使用: yourdomain/api.php?c=controller-name-class&m=method-used

我如何创建会话?

Session::set('session-name', 'session-value');

我如何加载组件 html?

View::component('component-name');

我如何在组件 html 中定义值?

在您的 html 文件内写入类似这样的内容: {{variableName}}
当您调用 View::component... 时,您需要编写 View::component('component-name', array(
'variableName' => variable-value
));