【发布时间】:2011-09-28 18:51:06
【问题描述】:
好的,所以我有一个类似于以下内容的 php 脚本:
<?php
$name = "Steve Jobs";
header('Location: http://www.apple.com/custom.php&name=' . $name);
?>
现在,我碰巧发现这个自定义“Hi there,Steve Jobs”页面的 URL 的 URL 为 http://www.apple.com/custom.php&name=Steve%20Jobs,这有点令人尴尬,因此想对其进行编码。
有没有一种简单的方法可以让这个名字更加晦涩难懂?有没有办法完全避免在 URL 中传递它?
【问题讨论】:
-
嗯,标题什么都不做......
-
废话...好吧,它在我的脚本中有效,所以想象一下它有效 ^.^
-
是的。要使用
header进行重定向,您需要使用header('Location: http://someaddress.com');。 -
如果您通过表单设置 $name,您可以使用 $_POST
-
@Marc Towler,它是从 PHP 脚本发送的。
标签: php variables customization