php-未知:0行需要打开失败。laravel 5.6

Ang*_*rpa 2 php xampp laravel-5.6

我刚刚安装了laracast / flash并通过composer更新了nesbot / carbon。在下载碳时,cmd发疯了。Cmd界面在界面上显示了一些分散的单词和文本框一段时间,下载完成。做php artisan servelocalhost:8000,我遇到了以下错误。

警告:未知:无法打开流:在第0行的“未知”中没有此类文件或目录

致命错误:未知:在第0行的“未知”中,无法打开所需的'C:\ xampp \ htdocs \ NC World \ ProjectName \ server.php'(include_path ='C:\ xampp \ php \ PEAR')

小智 15

在命令行中输入:

php -S localhost:8000 -t public
Run Code Online (Sandbox Code Playgroud)

因为端口不是公共的


小智 13

发生此错误是因为缺少server.php文件。可能是从项目目录中删除或删除了它。我已经遇到了这个问题。只需将server.php文件添加到项目的根目录即可。您可以从其他任何laravel项目目录添加此文件,也可以在laravel项目的根目录下创建一个名为server.php的文件,然后粘贴以下代码:

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */

$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';
Run Code Online (Sandbox Code Playgroud)

这个过程对我有用。


Iko*_*ong 9

尝试禁用您的防病毒软件,这发生在我身上,似乎avast删除了我的server.php。

所以我将其添加到异常中