PHP解析错误:语法错误,第13行/root/Desktop/generator/dump.php中的意外T_VARIABLE

时间:2013-09-21 07:42:30

标签: php

我的问题是我不明白为什么它实际上不起作用?我也是php的新手,所以我正在学习这个PHP。我不知道为什么它是一个意想不到的T_VARIABLE,我假设它意味着“$”

<?php
   include('database.class.php');
   $sql = new Database(NULL);

   $ids = $sql->select('*', '`ids` ORDER BY `UserId` ASC', NULL, NULL, NULL, true, true);

   $dump = array();
   foreach($ids as $index=>$id);
        $dump[] = $id['UserId'].' | REGLINK - http://xat.com/web_gear/chat/register.php?UserId='.$id['UserId'].'&k2='.$id['k2'].'&mode=1'

   $DumpFile= 'ids.txt';

   if(file_exists($DumpFile)) {
        unlink($DumpFile);
   }
   file_put_contents($DumpFile, implode("\r\n", $dump));
   die(count($dump).' ids were dumped into the list.'."\n");
?>

1 个答案:

答案 0 :(得分:1)

你必须在&amp; mode = 1'之后加上分号; 喜欢 :     

$ids = $sql->select('*', '`ids` ORDER BY `UserId` ASC', NULL, NULL, NULL, true, true);

$dump = array();
foreach($ids as $index=>$id);
        $dump[] = $id['UserId'].' | REGLINK - http://xat.com/web_gear/chat/register.php?UserId='.$id['UserId'].'&k2='.$id['k2'].'&mode=1';

$DumpFile= 'ids.txt';

if(file_exists($DumpFile)) {
        unlink($DumpFile);
}
file_put_contents($DumpFile, implode("\r\n", $dump));
die(count($dump).' ids were dumped into the list.'."\n");
?>