使用img src =" random.php"调用php脚本 [英] calling a php script using img src ="random.php"

查看:76
本文介绍了使用img src =" random.php"调用php脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有,


我有一个小的PHP脚本,可以在下面的

页面调用随机图像。
http://www.2006ymcanationals.com/random.php

IT工作如果我直接进入上面的链接。


我试图在另一个页面中调用它以便我得到一个随机图像

页面使用< http://2006ymcanationals.com/index.php ; img

src =" random.php">


它无效。我尝试使用

" random.php"的完整路径。我也试过命名主页index.html和

index.php。不工作。


我错过了什么?搜索这些群组看起来应该这样工作。


提前致谢。


Brad

Hey all,

I have a small php script that calls a random image at the following
page.
http://www.2006ymcanationals.com/random.php

IT WORKS IF I go directly to the above link.

I am trying to call that in another page so that i get a random image
the page is http://2006ymcanationals.com/index.php using <img
src="random.php">

It is not working. I have tried using the full path to the
"random.php". I have also tried naming the main page index.html and
index.php. neither work.

what am i missing? Searching these groups it looks like this should
work.

Thanks in advance.

Brad

推荐答案



< bh ***** @ gmail.com>在消息中写道

news:11 ********************* @ l41g2000cwc.googlegro ups.com ...

<bh*****@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
嘿所有,

我有一个小的PHP脚本,可以在下面的页面中调用随机图像。
http://www.2006ymcanationals.com/random.php

如果我直接去以上链接。

我试图在另一个页面中调用它,以便我得到一个随机图像页面是 http://2006ymcanationals.com/index.php 使用< img
src =" random.php">

它不起作用。我尝试使用
random.php的完整路径。我也试过命名主页index.html和
index.php。没有工作。

我错过了什么?搜索这些群组看起来应该这样。

提前致谢。

布拉德
Hey all,

I have a small php script that calls a random image at the following
page.
http://www.2006ymcanationals.com/random.php

IT WORKS IF I go directly to the above link.

I am trying to call that in another page so that i get a random image
the page is http://2006ymcanationals.com/index.php using <img
src="random.php">

It is not working. I have tried using the full path to the
"random.php". I have also tried naming the main page index.html and
index.php. neither work.

what am i missing? Searching these groups it looks like this should
work.

Thanks in advance.

Brad




没有查看代码就很难了。

图像似乎是页面上的不同名称。例如。 rimage2.jpg,

rimage3.jpg,rimage4.jpg,rimage5.jpg

Brent Palmer。




It''s hard without looking at the code.
The images seem to be different names on the page. Eg. rimage2.jpg,
rimage3.jpg, rimage4.jpg, rimage5.jpg

Brent Palmer.



bh*****@gmail.com 写道:

我有一个小的PHP脚本,可以调用随机图像
在下一页。
http://www.2006ymcanationals.com/random.php

如果我直接进入上述链接,它的工作原理。 />
我试图在另一个页面中调用它,以便我得到一个随机图像页面

I have a small php script that calls a random image
at the following page.
http://www.2006ymcanationals.com/random.php

IT WORKS IF I go directly to the above link.

I am trying to call that in another page so that i get
a random image the page is http://2006ymcanationals.com/index.php
using <img src="random.php">




实际上,在你的index.php页面中,它不是< img src =" random.php">,

它的< img href = QUOT; random.php"取代。纠正它,一切都应该工作......


干杯,

NC



Actually, in your index.php page, it''s not <img src="random.php">,
it''s <img href="random.php">. Correct it, and everything should
work...

Cheers,
NC


bh*****@gmail.com 写道:
如果我直接进入上面的链接,它会工作。

我试图在另一个页面中调用它,以便我得到一个随机的图像

它不起作用。

我错过了什么?搜索这些组看起来应该可以工作。
IT WORKS IF I go directly to the above link.

I am trying to call that in another page so that i get a random
image

It is not working.

what am i missing? Searching these groups it looks like this should
work.




您正在从PHP脚本输出HTML,而不是图像本身。


这就像你试图拥有< IMG SRC =" whatever.html"> - 我

不要以为你认为这样做(除非what.html实际上是

a非常奇怪的命名图像文件,当然)。


你应该在你的脚本中做的是为图像输出合适的标题

,并通过你的脚本传递图像。像

这样的东西:


<?php



You''re outputting HTML from your PHP-script, not the image itself.

It''s the same as if you try to have <IMG SRC="whatever.html"> - I
don''t think you suppose that to work (unless whatever.html actually is
a very strangely named image file, of course).

What you should be doing in your script is to output suitable headers
for the image, and pass the image through your script. Something like
this:

<?php


这篇关于使用img src =&quot; random.php&quot;调用php脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆