zoukankan      html  css  js  c++  java
  • 静态化

    效果:

    代码:

    <?php
    // + —— —— —— —— —— —— ——  —— —— —— —— —— —— —— —— ——  —— —— —— —— —— —— 
    // + 正则表达式,实现伪静态处理
    // + url:http://localhost/forgestatic/index.php/news-class12-id43.html
    // + —— —— —— —— —— —— ——  —— —— —— —— —— —— —— —— ——  —— —— —— —— —— —— 
    
    //设置输出编码
    header('Content-Type:text/html; charset=utf8');
    
    //获取参数信息
    //参数格式为:'/news-class12-id43.html'
    $_urlParam = $_SERVER['PATH_INFO'];
    
    // 匹配模式
    // 匹配后格式:
    // Array
    // (
    //     [0] => /news-class12-id43.html
    //     [1] => news
    //     [2] => class12
    //     [3] => class
    //     [4] => 12
    //     [5] => id43
    //     [6] => id
    //     [7] => 43
    // )
    $_pattern  = '#^/([a-z]+)-(([a-z]+)([0-9]+))-(([a-z]+)([0-9]+)).html$#';
    
    //接收数据参数
    $_paramArr = array();
    
    //匹配获取
    if ( preg_match($_pattern, $_urlParam, $_paramArr) ) {
    	//打印数据
    	echo '<pre>';
    	print_r($_paramArr);
    	echo '</pre>';
    } else {
    	exit('参数格式异常!');
    }
    
  • 相关阅读:
    xcode debug
    ios 使用Quartz 2D画虚线
    ios UIGestureRecognizer
    ios 实现带矩形框的屏幕截图
    ios UISegemetedControl
    centos最小安装之后无法使用ifconfig
    无线LoRa智能远传水表
    智能水表188协议汇总
    无线LoRa远传智能水表
    静电除尘器除尘原理
  • 原文地址:https://www.cnblogs.com/KTblog/p/5166392.html
Copyright © 2011-2022 走看看