What is the cause of the syntax error, unexpected '@', expecting', 'or') error?

Asked 2 years ago, Updated 2 years ago, 107 views

I am currently developing it at Ravel, but I will use the code below.

<?php /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider with a group which | contains the "web" middleware group. Now create something great! | */ Route::get('/', function() {return redirect('/tasks');}); Route::get('/tasks', 'TaskController@index'); Route::post('/tasks', 'TaskController@store'); Route::delete('/tasks/{task}', 'TaskController@destroy'); \URL::forceScheme('https');
<?php

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

Route::get('/', function() {return redirect('/tasks');});
Route::get('/tasks', 'TaskController@index');
Route::post('/tasks', 'TaskController@store');
Route::delete('/tasks/{task}', 'TaskController@destroy');

\URL::forceScheme('https');

laravel-5

2022-09-30 19:50

1 Answers

It seems that the code listed in your question should be single quote (', U+0027, APOSTROPHE) but left single quote (', U+2018, LEFT SINGLE QUOTATION MARK).(It seems that garbled code is posted on the website, and the editor and browser functions you are using can be converted without permission.)

In VS Code, the same display "syntax error, unexpected '@', expecting '', 'or')" (other errors are ignored…) is not garbled when uploading a question, but is actually incorrect in the source code.

Try replacing all left single quotes (') with the correct single quotes (') using editor bulk replacement.The difference in the display between the two is very difficult to understand, but if you change the font and review it, you will see it.


2022-09-30 19:50

If you have any answers or tips

Popular Tags
python x 4647
android x 1593
java x 1494
javascript x 1427
c x 927
c++ x 878
ruby-on-rails x 696
php x 692
python3 x 685
html x 656

© 2024 OneMinuteCode. All rights reserved.