![](/img/trans.png)
[英]Lithium framework multiple 'or' statements in a query (using mongoDB)
[英]Server error 500 using lithium framework and mongodb
尝试查询数据库(mongodb)时,如果删除查询,它显示的视图很好,但似乎出现500错误。 通过使用快速入门指南和其他在线教程,我看得出我做错了什么。
模型 -Posts.php
<?php
namespace app\models;
class Posts extends \lithium\data\Model {
}
控制器 -PostsController.php
<?php
/**
* Lithium: the most rad php framework
*
* @copyright Copyright 2015, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/
namespace app\controllers;
use app\models\Posts;
class PostsController extends \lithium\action\Controller {
public function index() {
$posts = Posts::find('all', array(
'conditions' => array('author' => 'tom')
));
return $this->render(array('layout' => false));
}
}
?>
查看 -index.html.php
包含一些没有PHP的文本,因为它试图使其首先工作。
您可能没有安装MongoDB吗? 这也可能与mod_rewrite有关(想到了AllowOverride)。 最好的选择是查看日志。
日志的位置取决于您使用的内容。 如果您在Ubuntu上使用Apache2,它将位于/ var / log / apache2中。
刷新页面时,在终端中运行此命令: tail -f /var/log/apache2/error.log
,其中将error.log
假定为日志文件名。 刷新页面时,您应该能够在终端中看到错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.