123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- // This class automatically generated by the System, for testing purposes
- class BenchAction extends Action {
- public function rawjson() {
- header('Content-type: application/json');
- die(json_encode(array('message' => 'Hello World!')));
- }
- public function rawdb() {
- $query_count = (int) $this->_request('queries');
- if (0 >= $query_count) {
- $query_count = 1;
- } elseif (500 < $query_count) {
- $query_count = 500;
- }
- $arr = array();
- $World = M('World');
- while (0 < $query_count--) {
- $id = mt_rand(1, 10000);
- $d = $World->find($id);
- $arr[] = $d;
- }
- header('Content-type: application/json');
- die(json_encode($arr));
- }
- public function rawfortunes() {
- $Fortunes = M('Fortune');
- $this->data = $Fortunes->select();
- $this->display();
- }
- }
|