Home >Backend Development >PHP Tutorial >52 PHP pseudo-static

52 PHP pseudo-static

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 09:12:491047browse

<code>1.通过伪静态访问的 url 页面仍然是动态页面。

2.设置成伪静态的目的是:让页面与 url 无关,二是让搜<strong>索引</strong>擎更容易收录</code>

1. Set pseudo-static
52 PHP 伪静态

<code>print_r(<span>$_SERVER</span>);</code>

52 PHP 伪静态

<code>/<span>/ /</span><span>2</span>/<span>1</span>.html
preg_match(<span>'/^\/(\d+)\/(\d+).html/'</span>,<span>$_SERVER</span>[<span>'PATH_INFO'</span>],<span>$arr</span>);

var_dump(<span>$arr</span>);</code>

52 PHP 伪静态

<code><span>echo</span><span>"<pre class="brush:php;toolbar:false">"</span>;
print_r(<span>$_SERVER</span>);

<span>// /2/1.html</span><span>if</span>(preg_match(<span>'/^\/(\d+)\/(\d+).html/'</span>,<span>$_SERVER</span>[<span>'PATH_INFO'</span>],<span>$arr</span>)){

    <span>$type</span> = <span>$arr</span>[<span>1</span>];
    <span>$category_id</span> = <span>$arr</span>[<span>2</span>];
    <span>//可以操作数据库</span>}<span>else</span>{
    <span>//看业务需求,如跳到404</span>
}


var_dump(<span>$arr</span>);</code>
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced 52 PHP pseudo-statics, including indexing. I hope it will be helpful to friends who are interested in PHP tutorials.

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