Home >Backend Development >PHP Tutorial >php klein路由库的一个问题

php klein路由库的一个问题

WBOY
WBOYOriginal
2016-06-06 20:26:391151browse

<code><?php require_once __DIR__ . '/vendor/autoload.php';
 
$klein = new \Klein\Klein();
 
$klein->respond('GET', '/hello-world', function () {
    return 'Hello World!';
});
 
$klein->dispatch();</code>

按照文档demo实例,的代码但是当我访问localhost/hello-world时页面却什么都没输出,在刷新chrome的f12时显示404 not found,文件包括整个文件夹的写权限已经给了775,求解答

回复内容:

<code><?php require_once __DIR__ . '/vendor/autoload.php';
 
$klein = new \Klein\Klein();
 
$klein->respond('GET', '/hello-world', function () {
    return 'Hello World!';
});
 
$klein->dispatch();</code>

按照文档demo实例,的代码但是当我访问localhost/hello-world时页面却什么都没输出,在刷新chrome的f12时显示404 not found,文件包括整个文件夹的写权限已经给了775,求解答

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn