且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP警告:在第0行的Unknown中没有这样的文件或目录

更新时间:2023-02-24 07:47:16

我知道这是一个老问题,但是我遇到了同样的问题,并且找到了解决方案,方法是将server.php文件添加到 root包含以下内容的项目目录:

I know this is an old question, but I was having the same problem and I found a solution by adding a server.php file to the root directory of the project with the following content:

<?php
$uri = urldecode(
    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri))
{
    return false;
}

require_once __DIR__.'/public/index.php';