|
本文介绍下,php在查询字符串中传递值的方法,举了二个例子,分别用来传递字符串值、数字值。有需要的朋友,参考下吧。
例1,在查询字符串中传递字符串值
<html>
<body>
<div align="center">
<p>Click a link to move to a new page:</p>
Content 1<br />
Content 2<br />
Content 3<br />
<?php
$page = trim (urldecode (stripslashes ($_GET['page'])));
if (isset ($page) && $page != ""){
if (is_file ($page)){
require_once ($page);
} else {
echo "<p>很抱歉,您请求的页面不存在。</p>";
}
}
?>
</div>
</body>
</html>登录后复制 例2,在查询字符串中传递数值
Perl学习手札 chm版
查看详情
Perl学习手札是台湾perl高手写的一篇文章,特打包为chm版,方便大家阅读。 关于本书 1. 关于Perl 1.1 Perl的历史 1.2 Perl的概念 1.3 特色 1.4 使用Perl的环境 1.5 开始使用 Perl 1.6 你的第一个Perl程序 2. 标量变量(Scalar) 2.1 关于标量 2.1.1 数值 2.1.2 字符串 2.1.3 数字与字符串转换 2.2 使用你自己的变量 2.3 赋值 2.3.1 直接设定 2.3.2 还可以这样 2.4 运算 2.5 变量的输出/输入 2.
0
<html>
<head>
<title>查询字符串传递数值-bbs.it-home.org</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<div align="center">
<p>Click a link to change the text color of the verbiage below:</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/7fc7563c4182" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">PHP免费学习笔记(深入)</a>”;</p>
Green<br />
Red<br />
Blue<br />
重置信息
<?php
if (isset ($_GET['color'])){
$color = intval ($_GET['color']);
} else {
$color = "";
}
if ($color == 1){
$fontcolor = "00FF00";
} elseif ($color == 2){
$fontcolor = "FF0000";
} elseif ($color == 3){
$fontcolor = "0000FF";
} else {
$fontcolor = "000000";
}
?><p style="color: #<?php echo $fontcolor; ?>; font-weight: bold;">欢迎访问程序员之家网站!</p><?php
?>
</div>
</body>
</html>登录后复制 |
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号