ci php框架,CI框架整合smarty步骤详解?

用户投稿 25 0

关于“php的ci框架下载”的问题,小编就整理了【2】个相关介绍“php的ci框架下载”的解答:

CI框架整合smarty步骤详解?

smarty的模板机制很强大,一般情况下CI无需整合其他模板标签,因为PHP本身就是一种标签,简单易用。codeigniter整合smarty教程(我用的都是最新版本)如下:

第一步:下载codeigniter最新版本:

第二步:下载smarty最新版本:

第三步:

配置步骤:

(1)将smarty拷贝到application/libraries下,然后再根目录下下新建templates,templates_c,config,cache目录,结构如下:

(2)入口文件新增:define('ROOT', dirname(__FILE__));

(3)libraries下新建CI_Smarty.php

$value) { $this->$key = $value; } } else { //ROOT是Codeigniter在入口文件index.php定义的本web应用的根目录 $this->template_dir = $template_dir ? $template_dir : ROOT . '/templates'; $this->compile_dir = $compile_dir ? $compile_dir : ROOT . '/templates_c'; $this->config_dir = $config_dir ? $config_dir : ROOT . '/config'; $this->cache_dir = $cache_dir ? $cache_dir : ROOT . '/cache'; } } }

CI框架怎么去掉隐藏入口文件index.php?

1.

  LoadModule rewrite_module modules/mod_rewrite.so,把该行前的#去掉。

  搜索 AllowOverride None(配置文件中有多处),看注释信息,将相关.htaccess的该行信息改为AllowOverride All。

  2.在CI的根目录下,即在index.php,system的同级目录下,建立.htaccess,直接建立该文件名的不会成功,可以先建立记事本文件,另存为该名的文件即可。内容如下(CI手册上也有介绍):

  RewriteEngine on

  RewriteCond $1 !^(index\.php|images|robots\.txt)

  RewriteRule ^(.*)$ /index.php/$1 [L]

  如果文件不是在www的根目录下,例如我的是:,第三行需要改写为RewriteRule ^(.*)$ /CI/index.php/$1 [L]。

  另外,我的index.php的同级目录下还有js文件夹和css文件夹,这些需要过滤除去,第二行需要改写为:RewriteCond $1 !^(index\.php|images|js|css|robots\.txt)。

到此,以上就是小编对于“php的ci框架下载”的问题就介绍到这了,希望介绍关于“php的ci框架下载”的【2】点解答对大家有用。

抱歉,评论功能暂时关闭!