首页 > 解决方案 > Laravel macOS 输入中的意外字符:'

问题描述

我使用 Parallels 提供程序在我的 macOS 上安装了 Vagrant。我使用命令创建了一个新项目laravel new blog

当我打开网站时,一切正常。然后我想用这些命令添加一个身份验证:php artisan make:auth php artisan migrate

第一个命令工作正常,但第二个产生错误:

PHP警告:输入中的意外字符:'在/home/vagrant/blog/routes/web.php第17行

我发现问题出在流浪盒子“宅基地”和 macOS 之间。因为在我关闭了宅基地和 macOS 之间的同步并重新安装了整个项目之后它工作正常。那你能告诉我问题出在哪里吗?是字符集吗?

这就是我的 web.php 的样子(我没有做任何更改):

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');

标签: phpmacoslaravel-5visual-studio-codevagrant

解决方案


它也发生在我身上。启用 NFS 解决了我的问题。不知道是什么原因。

宅基地.yaml

folders:
- map: ~/code
  to: /home/vagrant/code
  type: "nfs"

推荐阅读