$order_temp = $this->mdl_admin->get_latest_order_id($_POST['parent_id']);
if ($order_temp) {
$order = (string)$order_temp->order++;
var_dump($order);
die();
}
上面的代码产生了这个错误:
Message: Attempt to increment/decrement property of non-object
而vardump是string '' (length=0)
如果我只是做这样的事情来转储变量:
$order_temp = $this->mdl_admin->get_latest_order_id($_POST['parent_id']);
if ($order_temp) {
var_dump($order_temp);
die();
}
输出是:
array (size=1)
0 =>
object(stdClass)[28]
public 'id' => string '16' (length=2)
public 'name' => string 'sssssssssssssss' (length=15)
public 'slug' => string 'aaaaaaaaa' (length=9)
public 'title' => string 'aaaaaa' (length=6)
public 'body' => string '<p>asdas asd asd </p>' (length=21)
public 'order' => string '1' (length=1)
public 'parent_id' => string '5' (length=1)
我只想在 $order_temp->order 上加 1,所以如果 $order_temp->order = 2 结果 $order = 3。
我究竟做错了什么?