apache2 + mysql + thinkphp

1 环境搭建
http://imcn.me/html/y2012/12401.html
2 thinkphp 手册
http://document.thinkphp.cn/manual_3_2.html


从前端访问到thinkphp的过程
访问路径 http://X.X.X.X/oidbhelp/app/index.php/Home/Index/index.html

第一步:找到\oidbhelp\app\Application\Home\Controller 下 类IndexController.class.php 中类 IndexController 中的 index 方法

第二步:index 方法处理完后,最后的$this->show() 会找到oidbhelp\app\Application\Home\View\Index 下的 index.html,进行叶面展示

总结: thinkphp 会将url路径转换为对Controller 下对应文件的类的函数的调用,

函数中的show操作会调用oidbhelp\app\Application\Home\View\Index 下的静态页面用于展示。


><?php
namespace Home\Controller;
use Think\Controller;

include 'public/login.php';

class IndexController extends Controller {

    public function index(){
           
	    //get the all question
	    $question = D("Question");
        $ret = $question->field('qid,pid,content')->order('qid')->select();
        $arraylen = count($ret);

        $ret = json_encode($ret);

        $this->assign('items', $ret);

        $this->show();
    }

    public function managerQuestion() {
   
	    $keyword= D('Keyword');
	    $ret = $keyword->field('content')->select();
	    $ret = json_encode($ret);
	    $this->assign('kitems',$ret);

	    $question = D("Question");
	    $ret = $question->field('qid,pid,content')->order('qid')->select();
        $ret = json_encode($ret);
        $this->assign('qitems', $ret);
		
    	$this->show();
    }


    public function managerAnswer(){
    	$keyword= D('Keyword');
	    $ret = $keyword->field('content')->select();
	    $ret = json_encode($ret);
	    $this->assign('kitems',$ret);

	    $question = D("Question");
	    $ret = $question->field('qid,pid,content')->order('qid')->select();
        $ret = json_encode($ret);
        $this->assign('qitems', $ret);
	

    	$this->show();
    }


}
?>

index 方法处理完后,最后的$this->show() 会找到




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值