除联络网页外,所有网页都希望用墨头显示如下。 php包括:
<p><a href="contact.php">Contact</a></p>
网页contact.php
, 我想表明:
<p><a href="index.php">Home</a></p>
这应当纠正吗?
除联络网页外,所有网页都希望用墨头显示如下。 php包括:
<p><a href="contact.php">Contact</a></p>
网页contact.php
, 我想表明:
<p><a href="index.php">Home</a></p>
这应当纠正吗?
<?php
if (stripos($_SERVER[ REQUEST_URI ], contact.php )){
echo <p><a href="index.php">Home</a></p> ;
}
else{
echo <p><a href="contact.php">Contact</a></p> ;
}
if ($_SERVER["SCRIPT_NAME"] == /contact.php ) {
echo <p><a href="index.php">Home</a></p> ;
} else {
echo <p><a href="contact.php">Contact</a></p> ;
}
http://www.php.net/manual/en/maind.variables.server.php” rel=“nofollow”$_SERVER[PHP_SELF]
,其中载有你目前要求的网页名称。 加上basename(。 这一工作应当:
if( basename($_SERVER[ PHP_SELF ], .php ) == contact ) {
// Contact page
} else {
// Some other page
}
快速和 d脏的解决办法是:
<?php
$current_page = contact ;
include( inc_header.php );
....
?>
In inc_header.php:
<?php
if($current_page == contact ) {
// show home link
} else {
// show contact link
}
?>
如果发言,你可以简单地这样做,但这只能为你的联络页工作。 您也可在您的 in首档案中使用一种简单的功能,以便:
function LinkToPageOrHome( $script, $title ){
if ( strtolower( $_SERVER[ SCRIPT_NAME ] ) == strtolower( $script) ){
$script = home.php ;
$title = Home ;
}
echo <p><a href=" . $script. "> . htmlentities( $title ) . </a></p> ;
}
从设计角度看,它是一种unt法,但你可以使用LinkToPageOrHome(网页.php, 我的英文版);代码”在多个模板中,从不担心与自己有网页链接。
I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
I found this script online that creates a thumbnail out of a image but the thumbnail image is created with poor quality how can I improve the quality of the image. And is there a better way to create ...
如何确认来自正确来源的数字。
Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...
I wonder there is a way to post a message to a facebook business page with cURL? thanks
I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...
How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...