search
Homephp教程php手册url参数获取有关问题

url参数获取问题 有urlhttp://www.kaimen360.com/bargai.php?mod=showid=578 与 http://www.kaimen360.com/appraisals.php?mod=showid=79 怎么获取mod与id值? 怎么判断这个网页是appraisals.php还是bargai.php页面? ------解决思路----------------------

url参数获取问题
有urlhttp://www.kaimen360.com/bargai.php?mod=show&id=578

http://www.kaimen360.com/appraisals.php?mod=show&id=79
怎么获取mod与id值?
怎么判断这个网页是appraisals.php还是bargai.php页面?
------解决思路----------------------
怎么获取mod与id值?
$mode = $_GET['mode'];
$id = $_GET['mode'];

怎么判断这个网页是appraisals.php还是bargai.php页面?
无需判断,不是就进不来!

------解决思路----------------------
$filename = basename__FILE__);

这是没有意义的工作!
http://www.kaimen360.com/bargai.php?mod=show&id=578
只会进入 bargai.php
http://www.kaimen360.com/appraisals.php?mod=show&id=79
只会进入 appraisals.php
所以根本就不需要判断

你在 appraisals.php 中检查当面文件名是不是 bargai.php
这不是画蛇添足吗?
------解决思路----------------------
问题描述不完全。 听xuzuning 的 。
我估计楼主是把这两个url嵌入到一个另外一个脚本,然后再那里判断是来自哪个url。再决定title显示之类的。
赶紧设计的不是很合理。
------解决思路----------------------
是不是你的 bargai.php和appraisals.php的title是公共文件,所以要判断啊,要是只有部分不一样,就在公共里写title一样的地方,在具体页面用replace替换一下不同的,要是title完全不同,在自己页面直接写title就行,就像版主说的,不是apprai【本文来自鸿网互联 (http://www.68idc.cn)】sals.php肯定就不会进这个文件了,那就没有必要做判断了
------解决思路----------------------
怎么获取mod与id值?
$mode = $_GET['mode'];
$id = $_GET['mode'];

获取当前页面地址,可以这样写,不过既然能进入,当然就是当前页。
echo $_SERVER['REQUEST_URI'];

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

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.