English 中文(简体)
GetGet 父窗口在 IFrame 中的变量问题
原标题:Issue with GET variables of parent window in iframe

我有一个带有 URL 的父窗口 : http://example.com? val=test

在该页面的边框中,我需要让 val 附加到链接上。

目前,我这样做是在一个框架里:

<?php
$val = $_GET[ val ];
?>
<a href ="http://example.com/link.html?val=<?php echo $val ?>">Link</a>

The output contains extra / and like this:
http://example.com/link.html?val= test

是否有办法适当做到这一点?

最佳回答

尝试此 :

$val = trim(stripslashes($_GET[ val ])," ");
问题回答

您正经历着PHPs 魔法引言的痛苦。 您要么将其关闭( 预设), 要么脱下鞭笞。 详情请见 < a href="http://php. net/ manual/ en/ security. magic quotes.php" rel = “ no follow” > http://php. net/ manual/ en/ security. magic quotes.php 。

要完全禁用它们, 请把这个放进您的php. ini 文件中 。

; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off

要从$_GET 变量中删除这些变量,请使用条纹。

<?php
// from http://www.php.net/manual/en/security.magicquotes.disabling.php#91585
if (get_magic_quotes_gpc()) {
    function stripslashes_gpc(&$value)
    {
        $value = stripslashes($value);
    }
    array_walk_recursive($_GET,  stripslashes_gpc );
    array_walk_recursive($_POST,  stripslashes_gpc );
    array_walk_recursive($_COOKIE,  stripslashes_gpc );
    array_walk_recursive($_REQUEST,  stripslashes_gpc );
}
?>




相关问题
Brute-force/DoS prevention in PHP [closed]

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 ...

please can anyone check this while loop and if condition

<?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 = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

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 ...

Text as watermarking in PHP

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?

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 ...

热门标签