我正在尝试 var_dump 选择查询的结果(仅数据库行)。
我有一个简单的 TableGateway (facotry service_manager)
public function shwoContactFormMessages)
{
$select = new Select();
$select->from(self::$tableName);
return $this->selectWith($select);
}
我的控制器:
public function fooAction()
{
$test = $this->contactFormTable->shwoContactFormMessages();
var_dump($test);
// This will show the results the column and it is working
while ($item = $test->current())
{
echo $item->messageFrom . "<br>";
}
return $view;
}
var_dump($test) 的结果:
object(Zend\Db\ResultSet\ResultSet)#327 (8) {
["allowedReturnTypes":protected]=>
array(2) {
[0]=>
string(11) "arrayobject"
[1]=>
string(5) "array"
}
["arrayObjectPrototype":protected]=>
object(ArrayObject)#302 (1) {
["storage":"ArrayObject":private]=>
array(0) {
}
}
["returnType":protected]=>
string(11) "arrayobject"
["buffer":protected]=>
NULL
["count":protected]=>
int(5)
["dataSource":protected]=>
object(Zend\Db\Adapter\Driver\Pdo\Result)#326 (8) {
["statementMode":protected]=>
string(7) "forward"
["resource":protected]=>
object(PDOStatement)#307 (1) {
["queryString"]=>
string(49) "SELECT `hw_contact_form`.* FROM `hw_contact_form`"
}
["options":protected]=>
NULL
["currentComplete":protected]=>
bool(false)
["currentData":protected]=>
NULL
["position":protected]=>
int(-1)
["generatedValue":protected]=>
string(1) "0"
["rowCount":protected]=>
int(5)
}
["fieldCount":protected]=>
int(8)
["position":protected]=>
int(0)
}
我只想 var_dump 数据库行而不是上面的对象。