开发者

CakePHP - Controller without View & Model

How do I create a controller with no view and model?

Making a services_controller to spit out json.

This is what I have now.

var $uses = a开发者_如何转开发rray();

function test() {
    $this->autoRender = false;
    echo "test";
}

However, that doesn't print out the "test" message.

Thanks,

Tee


The above code actually works. The issue was somewhere else related to the Auth component.

Thanks,
Tee


Just write $this->autoRender = false; at the end of the function. It will surely work.


I know that using the statement below your controller is without reference to any model:

public $ uses = null;


$this->autoRender = false;

This one works like a die() function. Put it at the end of the function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜