0

这是一个深夜,所以我知道这是一个非常简单的问题。我有以下代码:

$letters = range('A', 'Z');
$inx = 0;
$unique = false;
$num = substr($vin,-6);
while($unique != true){
    if($inx > 0){
        $num = substr($vin,-6) + $letters[$inx];
    }
    $this->db->where('stockid', $num);
    $query = $this->db->get('vehicles');
    if($query->num_rows() < 1){
        $unique = true;
    }
    $inx++;
}

我收到一个错误,因为它没有拉出一个字母并将其添加到它声明的字符串中:

$num = substr($vin,-6) + $letters[$inx];
4

1 回答 1

0

您可以尝试改用它:

$num.=$letters[$inx];

相对

$num = substr($vin,-6) + $letters[$inx];

因为我们在Javascript中经常使用“+”。

于 2013-05-08T09:06:17.290 回答