【问题标题】:Parse error: syntax error, unexpected T_STRING with XAMPP解析错误:语法错误,带有 XAMPP 的意外 T_STRING
【发布时间】:2013-07-09 00:29:37
【问题描述】:

我正在关注http://www.raywenderlich.com/13511/how-to-create-an-app-like-instagram-with-a-web-service-backend-part-12#comments 教程。我打开了一个 XAMPP 服务器,当我打开 http://localhost/iReporter 时,因为 iReporter 是文件夹的名称,错误是

解析错误:语法错误,第 5 行 /Applications/XAMPP/xamppfiles/htdocs/iReporter/lib.php 中的意外 T_STRING

这是 lib.php 的代码:

<?

//setup db connection

$link = mysqli_connect("localhost","root","")

mysqli_select_db($link, "iReport");

//executes a given sql query with the params and returns an array as result function
query() {

global $link;

$debug = false;

//get the sql query
$args = func_get_args();
$sql = array_shift($args);
//secure the input
for ($i=0;$i<count($args);$i++) {
    $args[$i] = urldecode($args[$i]);
    $args[$i] = mysqli_real_escape_string($link, $args[$i]);
}

//build the final query
$sql = vsprintf($sql, $args);

if ($debug) print $sql;

//execute and fetch the results
$result = mysqli_query($link, $sql);
if (mysqli_errno($link)==0 && $result) {

    $rows = array();
    if ($result!==true)
    while ($d = mysqli_fetch_assoc($result)) {
        array_push($rows,$d);
    }

    //return json
    return array('result'=>$rows);

} else {

    //error
    return array('error'=>'Database error');
}

}

//loads up the source image, resizes it and saves with -thumb in the file name function thumb($srcFile, $sideInPx) {

$image = imagecreatefromjpeg($srcFile);

$width = imagesx($image);

$height = imagesy($image);

$thumb = imagecreatetruecolor($sideInPx, $sideInPx);

imagecopyresized($thumb,$image,0,0,0,0,$sideInPx,$sideInPx,$width,$height);

imagejpeg($thumb, str_replace(".jpg","-thumb.jpg",$srcFile), 85);

imagedestroy($thumb); imagedestroy($image); }

?&gt;

我的问题是什么?请帮忙!

--编辑--

现在它说我更改时第 35 行有错误 $link = mysqli_connect("localhost","root","")$link = mysqli_connect("localhost","root","");!

【问题讨论】:

    标签: xampp


    【解决方案1】:

    缺少一个“;”在行中

    $link = mysqli_connect("localhost","root","")
    

    而且必须是

    $link = mysqli_connect("localhost","root","");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-24
      • 1970-01-01
      • 2013-05-13
      • 2014-05-12
      • 1970-01-01
      • 2015-03-09
      • 1970-01-01
      • 2020-04-23
      相关资源
      最近更新 更多