Home >Backend Development >PHP Tutorial >这句代码是啥意思呢呢

这句代码是啥意思呢呢

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-20 12:34:261151browse

下面这段代码看不出个数来,哪里到哪里,乱七八糟的
$site_url = strtolower('http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/index.php')).'/shop/index.php');


回复讨论(解决方案)

$_SERVER['HTTP_HOST']是你的主机  localhost
substr 字符串截取
$_SERVER['PHP_SELF'  相当于你的文件地址 /shop/index.php
strrpos 查找字符串在另一字符串出现的位置

最后site_url 得到的就是localhost /shop/index.php

函数是什么意思都明白吧。
然后再一个一个echo 就不难理解了,先echo $_SERVER['PHP_SELF']; exit(); 看是什么,哪里不明白就先输出一下。

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