您好,我正在尝试获取 json_encoded 元素的值。
public function getDescription($noArticle){
$stmt = $this->prepare("SELECT description FROM Inventaire WHERE noArticle = '{$noArticle}' ");
$stmt->execute();
$result = $stmt->fetchAll();
return json_encode($result);
这将返回我 - > [{"description":"BMW M3"}] 是 json_encoded。
我只想得到“BMW M3”部分
我试过 :
$allo = $allo->getDescription(1);
$test = json_decode($allo);
echo $test->{"description"};
如果有人可以帮助我,那就不行了。谢谢