namespace Admin\Service;
use Think\Model;
class serviceinfoService extends Model
{
function __construct()
{
parent::__construct();
}
public function showMessage($value='')
{
echo "this is showMessage function";
# code...
}
}Controller 语句namespace Admin\Controller;
use Think\Controller;
class TestController extends Controller {
public function index(){
header('Content-type:text/html;charset=UTF-8');
// $datetime1 = date('2015-05-29 00:00:00');
// $datetime2 = date('2015-05-30 00:00:00');
// $interval = date_diff($datetime1, $datetime2);
// echo strtotime($datetime1);
// echo DateDiff('d',$datetime1,$datetime2);
//
//serviceinfoService
$serviceinfoServiceObj=D('serviceinfo','Service');
$serviceinfoServiceObj->showMessage();
}
}:(
Think\Model:showMessage方法不存在!
错误位置
FILE: F:\PHP_Project\www\workFlowProject_Update\ThinkPHP\Library\Think\Model.class.php LINE: 241
TRACE
#0 F:\PHP_Project\www\workFlowProject_Update\ThinkPHP\Library\Think\Model.class.php(241): E('Think\Model:sho...')
#1 F:\PHP_Project\www\workFlowProject_Update\App\Admin\Controller\TestController.class.php(26): Think\Model->__call('showMessage', Array)
#2 F:\PHP_Project\www\workFlowProject_Update\App\Admin\Controller\TestController.class.php(26): Think\Model->showMessage()
#3 [internal function]: Admin\Controller\TestController->index()
#4 F:\PHP_Project\www\workFlowProject_Update\ThinkPHP\Library\Think\App.class.php(164): ReflectionMethod->invoke(Object(Admin\Controller\TestController))
#5 F:\PHP_Project\www\workFlowProject_Update\ThinkPHP\Library\Think\App.class.php(202): Think\App::exec()
#6 F:\PHP_Project\www\workFlowProject_Update\ThinkPHP\Library\Think\Think.class.php(120): Think\App::run()
#7 F:\PHP_Project\www\workFlowProject_Update\ThinkPHP\ThinkPHP.php(97): Think\Think::start()
#8 F:\PHP_Project\www\workFlowProject_Update\index.php(15): require('F:\PHP_Project\...')
#9 {main}
ThinkPHP3.2.3 { Fast & Simple OOP PHP Framework } -- [ WE CAN DO IT JUST THINK ]使用的TP的版本为3.2.3 。还请哪位大侠 帮忙看看 最佳答案