我有一个控制器来加载和渲染图像。
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Image extends Controller {
public function action_topo($id=NULL) {
$fornecedor = ORM::factory('provider')
->where('nometag', '=', $this->request->param($id))
->find();
if ($fornecedor->loaded()) {
$local = 'media/fornecedor/' . $fornecedor->nometag . '/' . $fornecedor->sis_foto_baner;
$image = Image::factory($local);
$data = $image->render(NULL, 75);
} else {
$this->request->redirect('index');
}
}
}这很简单。在我的URL /image/topo/name_of_company中
当我加载页面时,什么也没有发生!问题出在哪里?
obs:我是框架的新手。
tks。
发布于 2012-03-28 22:35:26
我相信你的问题出在这一行:
public function action_topo($id = NULL) {和
->where('nometag', '=', $this->request->param($id))在3.2版本之前,您可以使用$id或$this->request->param('id'),但肯定不能使用$this->request->param($id) (从技术上讲,您可以使用,但它会产生意想不到的结果)。
从3.2开始,你应该这样做:
public function action_topo() {
$id = $this->request->param('id');
$fornecedor = ORM::factory('provider')
->where('nometag', '=', $id)
->find();https://stackoverflow.com/questions/9901699
复制相似问题