CodeIgniter $ this-> load-> model () não está funcionando
Estou usando codeigniter 2.1.2 e aqui está a minha situação agora. Eu tenho um modelo chamado math.php em C: \ wamp \ www \ cr8v \ application \ models. Eu estou tentando carregar isso no meu controlador de C: \ wamp \ www \ cr8v \ application \ controllers \ site.php ainda estou recebendo este erro:
Unable to locate the model you have specified: math_model
Aqui está o conteúdo de math.php
<?php
class Math_model extends CI_Model(){
public function add(){
return 1+1;
}
}
?>
E aqui está o conteúdo do meu site.php
<?php
class Site extends CI_Controller{
public function index(){
$this->addstuff();
}
public function addstuff(){
$this->load->model("math_model");
echo $this->math->add();
}
}
?>
Eu segui isso em um tutorial no youtube. no entanto, isso não me dá a saída desejada. Eu tentei googling sobre isso e ler outras questões relacionadas com isso, no entanto essas informações não são suficientes. Por favor ajude.
EDITADO Eu li isso há pouco tempo atrás
[http://stackoverflow.com/questions/8074368/codeigniter-php-model-access-unable-to-locate-the-model-you-have-specified][1]
agora eu tenho esse erro
( ! ) Parse error: syntax error, unexpected '(', expecting '{' in C:\wamp\www\cr8v\application\models\math_model.php on line 2
Call Stack
# Time Memory Function Location
1 0.0036 148768 {main}( ) ..\index.php:0
2 0.0062 185072 require_once( 'C:\wamp\www\cr8v\system\core\CodeIgniter.php' ) ..\index.php:202
3 0.0561 784312 call_user_func_array ( ) ..\CodeIgniter.php:359
4 0.0561 784360 Site->index( ) ..\CodeIgniter.php:359
5 0.0561 784376 Site->addstuff( ) ..\site.php:4
6 0.0561 784504 CI_Loader->model( ) ..\site.php:8