<?php if(!isset($_SESSION)){ session_start(); } $_SESSION['code'] = $cap['word']; /** *查询数据 */ public function check(){ $this->db->where(array('username'=>$username))->get('admin')->result_array(); $this->db->get_where('admin',array('username'=>$username)->result_array(); } ?> //在文件config.php文件中可以设置秘钥,这是CI框架提供的. $config['encryption_key']='sdfsfsdfggsdfg'; // session存数组 $session=array( 'username'=>$username, 'uid' =>$uid, ); 存: $this->session->set_userdata($session); 取: $this->session->userdata($session); /** * 格式化时间 */ <?php echo date('m-d',$this->session->userdata('logintime'))?> /** * 客户端IP,服务器信息,服务器环境 */ <?php echo $this->input->ip_address() ?> <?php echo $this->input->server('SERVER_SOFTWARE')?> <?php echo PHP_VERSION ?> /** * 隐藏单入口(-) */
1,保证Apache配置文件httpd.conf中的LoadModule rewrite_module modules/mod_rewrite.so开启(去掉#)
2,将相对应的目录AllowOverride改为ALL
3,在根目录下,在index.php同级目录下新建.htaccess
.htaccess内容:
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L]
4,config.php中设置
$config['index_page']改为空值
5,开启缓存
$this->output->cache(1/60);
以上就是CI框架随记4的内容,更多相关内容请关注PHP中文网(www.php.cn)!
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article
How to fix KB5055612 fails to install in Windows 10?
4 weeks agoByDDD
Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Roblox: Grow A Garden - Complete Mutation Guide
3 weeks agoByDDD
Nordhold: Fusion System, Explained
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

WebStorm Mac version
Useful JavaScript development tools
