CodeIgniter $ this-> load-> model () no funciona
Estoy usando codeigniter 2.1.2 y aquí está mi situación ahora mismo. Tengo un modelo llamado math.php en C: \ wamp \ www \ cr8v \ application \ models. Estoy tratando de cargar esto en mi controlador desde C: \ wamp \ www \ cr8v \ application \ controllers \ site.php, pero estoy recibiendo este error:
Unable to locate the model you have specified: math_model
Aquí está el contenido de math.php
<?php
class Math_model extends CI_Model(){
public function add(){
return 1+1;
}
}
?>
Y aquí está el contenido de mi 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();
}
}
?>
Seguí esto en un tutorial en youtube. sin embargo, no me da mi salida deseada. He intentado buscarlo en Google y leer otras preguntas relacionadas con esto, sin embargo, esa información no es suficiente. Por favor ayuda.
Editado He leído esto hace un rato
[http://stackoverflow.com/questions/8074368/codeigniter-php-model-access-unable-to-locate-the-model-you-have-specified◆◆1]
ahora tengo este error
( ! ) 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