900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > yaf支持php8 php yaf配置问题

yaf支持php8 php yaf配置问题

时间:2022-09-25 03:10:07

相关推荐

yaf支持php8 php yaf配置问题

#nginx.conf

location /wx

{

root /wx/public/index.php;

if (!-e $request_filename) {

rewrite ^/wx/(.*)$ /wx/public/index.php?$1 last;

}

}

//public/index.php

<?php

define('BASE_URL', 'http://localhost/wx/');

define("APP_PATH", realpath(dirname(__FILE__) . '/../'));

$app = new Yaf_Application(APP_PATH . "/conf/application.ini");

$app->bootstrap()->run();

#conf/application.ini

[product]

application.directory=APP_PATH "/application/"

application.dispatcher.catchException = TRUE

application.dispatcher.throwException = TRUE

application.modules=index,admin

application.view.ext = 'php'

为什么这样配置,访问

http://localhost/wx

会提示

Page was not found

Failed opening controller script /home/wwwroot/default/wx/application/controllers/Wx.php: No such file or directory

#0 /home/wwwroot/default/wx/public/index.php(7): Yaf_Application->run()

#1 {main}

public/index.php

打印

$_REQUEST

,是个空数组

目录结构:bootstrap.php在zapplication下,入口文件index.php在public下

补充一下,把域名绑定到/home/wwwroot/default/wx,用域名是可以访问的(rewrite规则要对应修改,不是上面那个),rewrite规则改成上面那个,再使用http://ip/wx访问(wx是yaf项目目录),就不行了。会把/wx/当成控制器

终于有问

Yaf

的了,真开森,楼主上下您的结构吧,是

Yaf

没找到你的引导。

设定了

admin

index

两模型,你将项目目录设定到

../application/

所以您的

bootstarp,php

也应该在这目录下,当bootstrap被调用的时刻, Yaf_Application就会默认的在APPLICATION_PATH下, 寻找Bootstrap.php, 而这个文件中, 必须定义一个Bootstrap类, 而这个类也必须继承自Yaf_Bootstrap_Abstract

楼主不妨在控制器下建立

wx.php

尝试一下,结构有些乱哈

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。