我正在使用新的CakePHP 2.1,并希望使用JsonView使我的控制器响应客户端jQuery创建的AJAX请求.
但是,这应该根据文档使用JsonView自动完成.
http://book.cakephp.org/2.0/en/views/json-and-xml-views.html
我在routes.php文件中添加了这一行
Router::parseExtensions('json');
Run Code Online (Sandbox Code Playgroud)
在我的控制器中我有
$this->RequestHandler->setContent('json', 'application/json' );
$bookings = $this->Bookings->find('all');
$this->set('bookings', $bookings);
$this->set('_serialize', 'bookings');
Run Code Online (Sandbox Code Playgroud)
然后视图应该是过时的,但是当我调用它时,它仍然提供一个指向缺少视图的页面.
这是我的问题的示例代码:
import multiprocessing, time
def nopr():
i=0
while 1:
i = i+1
print i
time.sleep(1)
p = multiprocessing.Process(target = nopr)
print "process started"
p.start()
time.sleep(04)
print "process ended"
p.terminate()
time.sleep(1)
p.start()
Run Code Online (Sandbox Code Playgroud)