带有变量

时间:2015-08-20 18:02:47

标签: php

我正在尝试将$row['uuid']传递到URL的末尾而没有成功,因此它会打开一个新窗口来显示位于网络驱动器上的jpeg文件。

我一直在尝试的代码是

echo'<table border="1" ><th >Date and Time</th><th>Plate</th>   <th>Confidence</th><th>Image Name</th>';
while($row = mysql_fetch_array($result)) {
    echo "<tr>";
    echo "<td>" . $row['dt'] . "</td>";
    echo "<td>" . $row['plate'] . "</td>";
    echo "<td>" . $row['confidence'] . "</td>";
echo "<td><a href='http://192.xxx.x.xx/Pictures/plates/.$row['uuid'] .' target='blank_'>" . $row['uuid'] . "</a></td>";
    echo "</tr>";
}
echo "</table>";

我不断得到的错误是:

  

PHP Parse错误:语法错误,意外''(T_ENCAPSED_AND_WHITESPACE),期待标识符(T_STRING)或变量(T_VARIABLE)或数字(T_NUM_STRING)

我尝试过将$row['uuid']添加到网址末尾的不同方法,但没有成功。

3 个答案:

答案 0 :(得分:2)

你只是错过了echo'<table border="1" ><th >Date and Time</th><th>Plate</th> <th>Confidence</th><th>Image Name</th>'; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['dt'] . "</td>"; echo "<td>" . $row['plate'] . "</td>"; echo "<td>" . $row['confidence'] . "</td>"; echo "<td><a href='http://192.xxx.x.xx/Pictures/plates/'".$row['uuid'] ."' target='blank_'>" . $row['uuid'] . "</a></td>"; echo "</tr>"; } echo "</table>"; 尝试这个,看看它是否有效

var location : String = ""
var theLocation = CLLocation(latitude: latitude, longitude: longitude)

func getLocation(theLocation: CLLocation) {
    let geoCoder = CLGeocoder()

    geoCoder.reverseGeocodeLocation(theLocation, completionHandler: { (placemarks, error) -> Void in
        let placeArray = placemarks ?? []

        var placeMark: CLPlacemark!
        placeMark = placeArray[0]

        self.location = placeMark.postalCode!
    })
}

答案 1 :(得分:0)

嗨,只要没有圆点就可以了:

echo "<td><a href='http://192.xxx.x.xx/Pictures/plates/".$row['uuid'].".jpg' target='blank_'>" . $row['uuid'] . "</a></td>";
    echo "</tr>";

saftly add .jpg

#define RAM_BANK0 0x80

static volatile uint8_t time2ms __attribute__((at(RAM_BANK0)));
static volatile uint8_t t500ms  __attribute__((at(RAM_BANK0 + 1)));
static volatile uint8_t t1s  __attribute__((at(RAM_BANK0 + 2)));
static volatile uint16_t time1s_dis __attribute__((at(RAM_BANK0 + 3)));
static volatile Flag_t flag __attribute__((at(RAM_BANK0 + 5)));

答案 2 :(得分:0)

问题很明显就是这一行:

echo "<td><a href='http://192.xxx.x.xx/Pictures/plates/.$row['uuid'] .' target='blank_'>" . $row['uuid'] . "</a></td>";

您在这里使用2种方法将$row['uuid']放入字符串中。后一种方法,停止字符串并将其与.运算符连接,工作正常。

但是,第一种直接将其插入双引号字符串的方法不适用于数组索引。此外,您不需要连接点.。 要么使用其他方法

echo "<td><a href='http://192.xxx.x.xx/Pictures/plates/" . $row['uuid'] . "' target='blank_'>" . $row['uuid'] . "</a></td>";

或使用花括号将变量封装在字符串中:

echo "<td><a href='http://192.xxx.x.xx/Pictures/plates/{$row['uuid']}' target='blank_'>" . $row['uuid'] . "</a></td>";