douhuang4166 2012-09-19 09:31
浏览 31
已采纳

如何在Symfony 2中运行普通的mysql查询?

How to run plain mysql queries in Symfony 2, just like this:

$query = $this->db->run('select * from table');
$rs = $this->db->fetchAll($query);

foreach($rs as $r) {
    ...
}
  • 写回答

1条回答 默认 最新

  • donglaoe2979 2012-09-19 09:34
    关注

    It's well explained how to do it with some examples, here:

    http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/native-sql.html

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?