php class Index extends Phalcon Mvc Model public function initialize t

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
class Index extends \Phalcon\Mvc\Model {
public function initialize() {
$this->setSource('hash');
}
public function getSource() {
return 'hash';
}
public function getmd5($s){
$md5 = md5($s);
$this->modelsManager->executeQuery('INSERT INTO index (text,md5) VALUES('.$s.','.$md5.') ');
}
}
class IndexController extends ControllerBase {
public function indexAction() {
for($s = 1; $s < 100; ++$s){
Index::getmd5($s);
}
$query = $this->modelsManager->createQuery('SELECT * FROM index');
$cars = $query->execute();
$this->view->setVar('ss', $cars);
}
}
?>