tp框架就是把TP_3.2.2拷贝到phpstudy下的WWW里面
首先,在TP_3.2.2/Home/Conf/config.php下填写如下配置
<?php return array( 'DB_TYPE' => 'mysql', // 数据库类型 'DB_HOST' => '127.0.0.1', // 服务器地址 'DB_NAME' => 'test', // 数据库名 'DB_USER' => 'root', // 用户名 'DB_PWD' => 'root', // 密码 'DB_PORT' => '3306', // 端口 );
然后在TP_3.2.2/Home/Controller/xxxx.php进行功能函数的书写
模块:
添加数据
/******************************
用于插入数据到指定的表里面
*********************************/
public function login(){ // $Verify = new \Think\Verify(); // $Verify->entry(1); // print_r($Verify->entry(1)); // print_r(array('verify_code'=>'当前验证码的值','verify_time'=>'验证码生成的时间戳')); //$this->display('Base/base'); $User = M('fuck'); $data['id']=''; $data['news']="南海阅兵"; $data['sex']="男"; $data['age']=18; $User->add($data); $this->sel(); } public function sel(){ $User = M('fuck'); $data = $User->select(); echo "<table border='2'><tr><th>{$data[1]['id']}</th></tr><tr><th>{$data[1]['news']}</th></tr><tr><th>1</th></tr></table>"; }