基于Swoole,Yaf开发的C扩展框架

网友投稿 591 2022-10-25

基于Swoole,Yaf开发的C扩展框架

基于Swoole,Yaf开发的C扩展框架

Syx - base of Yaf 3.0.4

Requirement

PHP 7.0 +

Install

Compile Syx in Linux

$ /path/to/phpize$ ./configure --with-php-config=/path/to/php-config$ make && make install

Tutorial

layout

A classic Application directory layout:

- .htaccess // Rewrite rules+ public | - index.php // Application entry | + css | + js | + img+ conf | - application.ini // Configure- application/ - Bootstrap.php // Bootstrap + index // index module + controller - Index.php // Default controller + model - User.php // Model + view |+ index - index.html // View template for default controller + plugin - System.php+ library

DocumentRoot

you should set DocumentRoot to application/public, thus only the public folder can be accessed by user

index.php

index.php in the public directory is the only way in of the application, you should rewrite all request to it(you can use .htaccess in Apache+php mod)

bootstrap() //call bootstrap methods defined in Bootstrap.php ->run();

Rewrite rules

Apache

#.htaccessRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteRule .* index.php

Nginx

server { listen ****; server_name domain.com; root document_root; index index.php index.html index.htm; if (!-e $request_filename) { rewrite ^/(.*) /index.php/$1 last; }}

Lighttpd

$HTTP["host"] =~ "()?domain.com$" { url.rewrite = ( "^/(.+)/?$" => "/index.php/$1", )}

application.ini

application.ini is the application config file

[product];CONSTANTS is supportedapplication.directory = APPLICATION_PATH "/application/"

alternatively, you can use a PHP array instead:

array( "directory" => application_path . "/application/", "namespace" => 'app' // application default namespace ),);$app = new Syx\Application($config);....

default controller

In Syx, the default controller is named Index:

getView()->content = "Hello World"; }}

view script

The view script for default controller and default action is in the application/index/view/index/index.html, Syx provides a simple view engineer called "Syx\View\Simple", which supported the view template written by PHP.

Hello World

Run the Applicatioin

http://yourhostname.com/

Todo list

Single moduleIntegrated swoole

QQ Group

QQ Group: 545348293

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:node-eagle:基于Node的高性能MVC框架
下一篇:springboot2.6.4集成swagger3.0遇到的坑及解决方法
相关文章

 发表评论

暂时没有评论,来抢沙发吧~