php parse error, unexpected $end 的奇怪问题

dengweiid 2010-03-19 01:19:44
描述如下:

如题错误 搜了一下 可能是 语法错误 多了{}<??> 等等

但是看了没有类似错误

另外 删除 这段:

function __destruct(){
` mysql_close($this->conId);
}

后 错误就没有了

是否 有什么秘密?

请指教

代码跟帖附上
...全文
89 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
dengweiid 2010-03-19
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 foolbirdflyfirst 的回复:]
` mysql_close($this->conId);
你没发现最开头有`这个字符吗?
`````````````````
``````````````````
```````````````````
```````````````````
[/Quote]

我靠,你怎么看出来的!!!
谢谢哦。。。哭啊。。。
foolbirdflyfirst 2010-03-19
  • 打赏
  • 举报
回复
` mysql_close($this->conId);
你没发现最开头有`这个字符吗?
`````````````````
``````````````````
```````````````````
```````````````````

dengweiid 2010-03-19
  • 打赏
  • 举报
回复
<?php
class connection{
public $conId = null;
private $properties = array();

function __construct(){
$this->readConfig();

$db_host = $this->properties["db_host"];
$db_user = $this->properties["db_user"];
$db_password = $this->properties["db_password"];
$this->doConnection($db_host, $db_user, $db_password);
}

function __destruct(){
` mysql_close($this->conId);
}


function doConnection($db_host, $db_user, $db_password){
$this->conId = mysql_connect($db_host, $db_user, $db_password) or die('Cannot connect to db: ' . mysql_error());
mysql_select_db($db_name,$this->conId);
if($this->conId){
echo "连接成功";
}else{
echo "连接失败";
}
}

function readConfig(){
$file_handle = fopen("../web.config", "r");
while (!feof($file_handle)) {
$line = fgets($file_handle);

$tempArray = explode("=", $line);
for($i = 0;$i < count($tempArray);$i++){
$temp = $tempArray[$i];
$tempArray[$i] = trim($temp);
}
$property = $tempArray[0];
$value = $tempArray[1];
$tempArray = array($property=>$value);
$this->properties = array_merge($this->properties , $tempArray);
}
fclose($file_handle);
}
}
new connection();
?>

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧