문제

I try to build a REST interface using the Fat Free Framework. I use the following code to query the database:

$product = new DB\SQL\Mapper($this->db, 'product');
$product->load(array('id=?', $this->productID));

I can now return for instance the title with

echo json_encode($product->title);

But how do I return the whole row? The following won't work

echo json_encode($product);
도움이 되었습니까?

해결책

Found it. Had to use

echo json_encode($product->cast());
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top