语法错误,意外'''(T_STRING)PHP

时间:2015-07-08 08:36:19

标签: php syntax

运行PHP脚本时出现以下错误:

Symfony \ Component \ Debug \ Exception \ FatalErrorException
syntax error, unexpected '′' (T_STRING)

。 Symfony的\分量\调试\异常\ FatalErrorException ... /应用/ filters.php:72

    Route::any(‘check/purchase-code’, function() {if ($code = Input::get(‘code’)) {ini_set(‘user_agent’, ‘Mozilla/5.0′);$result = “”;if ($result = 1) {Session::put(‘valid-usage’,’1′);return Redirect::route(‘install-db-info’);}}return Redirect::to(‘/install’);});
Route::filter(‘user-auth’, function()

3 个答案:

答案 0 :(得分:1)

将所有个字符替换为'"

您可能从互联网上复制了代码,并且在复制过程中出现了问题

答案 1 :(得分:0)

PHP中的有效字符串分隔符是引用'和双引号"。 Backtick或撇号不在列表中。

请参阅文档:https://secure.php.net/manual/en/language.types.string.php

答案 2 :(得分:0)

替换此行(确定约'"

Route::any(‘check/purchase-code’, function() {if ($code = Input::get(‘code’)) {ini_set(‘user_agent’, ‘Mozilla/5.0′);$result = “”;if ($result = 1) {Session::put(‘valid-usage’,’1′);return Redirect::route(‘install-db-info’);}}return Redirect::to(‘/install’);});
Route::filter(‘user-auth’, function()

到这个

Route::any('check/purchase-code', function() {if ($code = Input::get('code')) {ini_set('user_agent', 'Mozilla/5.0');$result = "";if ($result = 1) {Session::put('valid-usage','1');return Redirect::route('install-db-info');}}return Redirect::to('/install');});
Route::filter('user-auth', function()