且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我可以使用PHP将URL变量传递给IFrame吗?

更新时间:2023-02-25 14:52:03

iFrame只需要一个网址 - 参数可以嵌入到网址中。

iFrames just take a url - and parameters can be embedded in urls just fine.

问题,如果我清楚地理解了这个问题,就是你在混淆你的报价:

The problem, if I understand the question clearly, is that you're mixing up your quotes:

 echo "<iframe src='sitename.com.au/directory/app/pagename.cfm?memberid='$val'
        width='100%' scrolling='vertical'></iframe>";

将输出为

 <iframe src='sitename.com.au/directory/app/pagename.cfm?memberid=' 21254545' 
  width='100%' scrolling='vertical'></iframe>

其中21254545是iframe的一个属性,而不是url的一部分。

where 21254545 is an attribute of the iframe instead of part of the url.

假设您实际上不需要网址中的引号,请将回显线更改为:

Assuming that you don't actually need the quotes in the url, change the echo line to:

echo "<iframe src='sitename.com.au/directory/app/pagename.cfm?memberid=$val' width='100%' scrolling='vertical'></iframe>";

它应该有效。