【发布时间】:2016-02-13 06:22:56
【问题描述】:
自从安装 Mac OSX El Capitain 后,我遇到了解析错误。该代码在服务器上运行良好,但在我的开发工作站上,我一直收到此错误。
解析错误:第 4 行 /Library/WebServer/Documents/website/includes/config.php 中的解析错误
// Calling code snippet:
include("includes/navbar.php");
require_once("includes/config.php");
$servername = DBHOST;
$username = DBUSER;
$password = DBPASS;
$database = DBNAME;
config.php 文件:
<?php
/* Config File for Common Values */
define ("DBHOST", “127.0.0.1:3306”); <--- This is line 4
define ("DBUSER", “userid”);
define ("DBPASS", “password”);
define ("DBNAME", “database”);
?>
【问题讨论】:
-
当您使用文字处理应用而不是代码编辑器进行编码时会发生这种情况。
-
"、第 5、第 6 和第 7 行。
-
@sa-7 您的待编辑 stackoverflow.com/review/suggested-edits/10175384 显然正在更改代码。不要那样做。如果 OP 使用它,那么这就是问题所在,并根据它给出了答案。您可以修改标签、拼写等,但不能修改代码。
标签: php parsing osx-elcapitan require-once