为了账号安全,请及时绑定邮箱和手机立即绑定

快速入门ThinkPHP框架—理论篇

Donsen PHP开发工程师
难度中级
时长 3小时51分
学习人数
综合评分9.43
169人评价 查看评价
9.8 内容实用
9.3 简洁易懂
9.2 逻辑清晰
  • 3.2.3 已经不是这个结构了...
    查看全部
  • U('地址','参数','伪静态','是否跳转','显示域名'); U('模块/方法', array('id'=>1)), 'xxxx html htm sthml', true/false, 'localhost') 一般是用到前面两个就差不多了 U('模块/方法',array('id'=>1),'html',true/false,'localhost'); 第二个参数是传参的值 第三个参数是后缀名,一般为html,htm,shtml 第四个参数是是否需要跳转,通常设为false,不需要跳转 第五个参数是域名 例子:U('Index/user',array('id'=>1),'html',true,'localhost');
    查看全部
  • thinkPHP中url模式中隐藏入口文件index.php的方法: 1.httpd.conf配置文件中加载了mod_rewrite.so模块 //在APACHE里面去配置 #LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉 2.AllowOverride None 讲None改为 All 在APACHE里面去配置 (注意其他地方的AllowOverride也统统设置为ALL) <Directory "D:/server/apache/cgi-bin"> AllowOverride none 改 AllowOverride ALL Options None Order allow,deny Allow from all </Directory> 3.确保URL_MODEL设置为2,在项目的配置文件里写 return Array( 'URL_MODEL' => '2', ); 4 .htaccess文件必须放到跟目录下 这个文件里面加: <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule>
    查看全部
  • 学习的内容。。
    查看全部
  • //1.直接用字符串进行查询 $data=M('User')->where('id=1')->select(); //2.使用数组方式进行查询 $where['user_name']="xiaoming";//查询条件 $where['_logic']='or';//查询方式 //3. 表达式查询 //eq(=) neq(!=) egt(>=) gt(>) lt(<) elt(<=) //like(like) between (between and) not between(not between and) in (in) not in (not in) and(and[默认]) //$where['字段名']=array('表达式',查询条件); //$where ['id']=array('lt',3);//查询<3的数据 $where['id']=array('between','1,8');//查询id是1到8的数据 $where['id']=array('lt'3);//查询id<3的数据 $where['user_name']=array('like',array('%ming','xiao%'));//查询user_name模糊等于%ming 模糊等于xiao的数据 //4.区间查询 where['id']=array(array('gt',100),array('lt',3),'or');//查询>100 或者<3的数据 //5.混合查询 $where['id']=array('gt' 10);//查询id>10的数据 $where['_string']='scoer>10';// 查询scoer>10的数据 //6.统计用法 // count统计数量 可选 // max 获取最大值 必须传入 统计的字段名 // min 获取最小值 必须传入 统计的字段名 // avg 平均值 必须传入 统计的字段名 // sum 求和 必须传入 统计的字段名 $data =M('user')->min('id');//查询语句(其中id是传入的值)
    查看全部
  • 1直接使用字符串进行查询 $data=M('User')->where('id=11')->select(); 2使用数组的方式进行查询 $where['id']=1; $where['user_name']='xiaohong'; $where['_logic']='or';//默认AND $data=M('User')->where($where)->select(); dump($data); 3表达式查询 $where['字段名']=array(表达式,查询条件); $where['id']=array('gt',13); $where['id']=array('between','12,14'); $where['id']=array('in','12,14'); $where['user_name']=array('like','%hong'); $where['user_name']=array('like',array('%ming','%hong')); $data=M('User')->where($where)->select(); 4区间查询 $where['id']=array(array('gt',12),array('lt',15)); $where['id']=array(array('gt',15),array('lt',12),'or');//默认AND $data=M('User')->where($where)->select(); 5混合用法 尽量不要用混合和字符串查询 $where['id']=array('gt',10);$where['_string']='score>10'; $data=M('User')->where($where)->select(); 6统计用法 $data=M('User')->count();//统计数量 可选 $data=M('User')->max('id');//求最大值 须传入字段名 $data=M('User')->min('id');//求最小值 须传入字段名 $data=M('User')->avg('score');//求平均值 须传入字段名 $data=M('User')->sum('score');//求和 必传入字段名
    查看全部
  • 开启隐藏index.php: 1、apache httpd.conf 开启rewrite.so 2、index.php同级目录下建立 .htaccess 录入 <Ifmodule mod_rewrite> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1[QSA,PT,L] </Ifmodule>
    查看全部
  • 首先:重写模式需要配置apache.。。。。。找到rewrite.so把前面#删掉。。 第二:项目里建立rewrite规则文件。。 .htaccess..和index.php同级。。
    查看全部
  • TP模板引擎之区间标签(in notin between notbetween range) <in name='num' value='1,2,3'>在</in>(判断是否在1,2,3之间) <notin name='num' value='1,2,3'>不在</notin> <in name='num' value='1,2,3'>在<else/>不在</in> <between name='num' value='1,10'>在</between>(判断是否在1到10之间) <notbetween name='num' value='1,10'>在</notbetween> <between name='num' value='1,10'>在<else/>不在</between> <range name='num' value='1,2,3' type='in'>在<else/>不在</range>(type的值在3.1版本中只能为in/notin,而在3.2版本中可以用in/notin/between/notbetween
    查看全部
  • zend最多,thinkPHP次之。额,Smarty呢?
    查看全部
  • 1.自定义模型 //也可以直接继承自Model类 class UserModel extends CommonModel{ protected $_scope=array( /*'命名范围的标识名'=>array( '属性'=>'值', 支持的方法有:where limit field order table page having goup distinct )*/ 'jige'=>array( 'where'=>array( 'score'=>array('egt',60), ), 'order'=>'id asc', 'limit'=>10 ), "ziduan"=>array( 'field'=>"nick_name,score", 'limit'=>5 ) //有重复声明,则后面的定义会覆盖前面的 ); } 2.使用: public function fanwei(){ //命名范围 $user=D("User"); $data=$user->scope("jige,ziduan")->select(); echo M()->getLastSql(); 重复声明:$data=$user->scope("jige,ziduan")->limit(2)->select(); 相应的结果:SELECT `nick_name`,`score` FROM `imooc_user` WHERE ( `score` >= 60 ) ORDER BY id asc LIMIT 2 } 3.结果: SELECT `nick_name`,`score` FROM `imooc_user` WHERE ( `score` >= 60 ) ORDER BY id asc LIMIT 5
    查看全部
  • //TP框架内置了一个抽象的数据库的访问层,这个访问层封装了特类的数据库操作 //------mysql式数据库连接方法----- 'DB_TYPE'=>'muysql',//数据库类型 'DB_HOST'=>'localhost,localhost1,localhost2',//数据库服务器地址 'DB_NAME'=>'mooc',//数据库名 'DB_USER'=>'root',//数据库用户 'DB_PWD'=>'',//数据库用户密码 'DB_PORT'=>'3306',//数据库端口(默认3306),可以不配置 'DB_PREFIX'=>'mc_',//数据库表前缀 //数据库配置好后,并非立即连接,TP数据库连接是一种惰性连接,只有在实例化时才连接。 //开启主从读写分离,读操作使用从服务器,写操作使用主服务器,这样就能给数据库进行负载均衡 'DB_RW_SEPARATE'=>true, //多个主数据库服务器,localhost,localhost1为主服务器,localhost2为从服务器 'DB_MASTER_NUM'=>'2',
    查看全部
    2 采集 收起 来源:连接数据库

    2018-03-22

  • 体系有很多设计模式,比如MVC,单列,VR等。 为什么要使用框架? 快速稳定的业务系统;灵活、易维护、不改变业务系统、可以替换框架、专注于业务系统的设计。 什么时候能用到框架? 快速开发企业应用、强大的管理系统。 什么时候不需要用框架? 不知道,后期学习 调研 开源的其他的解决方案比如:GRM/ERP/GRS. 整洁、干净、节约时间。
    查看全部
    2 采集 收起 来源:框架简介

    2015-09-10

  • 1,在index.php文件中,开启APP_DEBUG 设为true每次都会加载Runtime文件,于是config.php中的每次修改,都会产生作用,便于调试。但是项目上线后应该设为false,不用每次加载Runtime文件,节省资源。 2,自定义的配置文件,LOAD_EXT_CONFIG=>'user',才能使用;但是自定义的配置文件不会被编译,在项目运行时,每次都要加载它,所以不建议自己建立配置文件。
    查看全部
  • <eq name='num' value='10'>num=10<else/>num!=10</eq> <neq name='num'value='10'>num=10</neq> <compare name='num' value='11' type='eq'>num=11<else/>num!=11</compare>
    查看全部
首页上一页1234567下一页尾页

举报

0/150
提交
取消
课程须知
1、PHP基础语法 2、MYSQL常用的SQL语句 3、面向对象开发思想
老师告诉你能学到什么?
1、理解框架的概念 2、熟练掌握tp框架的基础用法 3、简单的使用tp框架进行相关开发

微信扫码,参与3人拼团

意见反馈 帮助中心 APP下载
官方微信
友情提示:

您好,此课程属于迁移课程,您已购买该课程,无需重复购买,感谢您对慕课网的支持!