PHP CI框架的安装配置和简单使用

论坛 期权论坛     
选择匿名的用户   2021-6-2 17:58   212   0
<span style="color:#454545"><span style="font-family:Tahoma">概述和基本配置参数 <span style="font-family:tahoma,helvetica,arial; font-size:14px; color:#454545; line-height:21px">配置CI:</span></span></span>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> application/config/config.php:14配置你的域名</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> application/config/database.php:40配置你数据库的相关参数</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> 配置基于htaccess的重定向</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> RewriteEngine on</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> RewriteCond $1 !^(index.php|images|robots.txt)</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> RewriteRule ^(.*)$ /index.php/$1 [L]</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> 任何除开 index.php,images, 和robots.txt 的 HTTP 请求都当成对 index.php 文件的请求。</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> 增加 URL 后 缀</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> application/config/config.php:57 配置$config[&#39;url_suffix&#39;] &#61; &#34;.html&#34;;</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> 配置后带或不带后缀都可以访问</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> 使用index.php的get方式访问控制类</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> application/config/config.php中:</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> $config[&#39;enable_query_strings&#39;] &#61; true;<br> $config[&#39;controller_trigger&#39;] &#61; &#39;c&#39;;<br> $config[&#39;function_trigger&#39;] &#61; &#39;m&#39;;</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> 访问方式:index.php?c&#61;controller&amp;m&#61;method</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> 自定义的简单的控制类</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> &lt;?php</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px"> class Blog extends Controller {<!-- --></p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px">  </p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px">               function index()</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px">               {<!-- --></p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px">                             echo &#39;Hello World!&#39;;</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left:0px; padding-right:0px; font-family:tahoma,helvetica,arial; color:rgb(69,69,69); font-size:14px; padding-top:0px">               }</p>
<p style="padding-bottom:0px; line-height:21px; margin:0px; padding-left
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP