我已經創建了HTML像一個iframe:獲得404未找到錯誤,而分配的PHP文件作爲源,即使我的PHP文件有
<p class="input-block">
<iframe src="php/image.php" height="50" width="100" scrolling="no" frameborder="0" marginheight="0" marginwidth="0" class="captcha-frame" name="captcha_image_frame"></iframe>
</p>
這個HTML文件位於inetpub/wwwroot/Site
下,並有一個圖像.php文件在inetpub/wwwroot/Site/php
之下。然而,當我進入的HTML網頁,我看到控制檯上的錯誤:
GET http://demo.com/php/image.php 404 (Not Found)
如果我偶然SRC爲「http://localhost/php/image.php
」,然後我得到的錯誤:
GET http://localhost/php/image.php net::ERR_CONNECTION_REFUSED
注:當我進入http://demo.com/php/image.php
,我也沒有找到錯誤,但我希望不會得到它,因爲有一個image.php下的php文件夾:(
問題是,我怎麼能設法將image.php分配給iframe源。如果有人幫忙,我很感激。
謝謝!
*演示不是原始域名。
編輯: image.php內容:
<?php
session_start();
header("(anti-spam-content-type:) image/png");
$enc_num = rand(0, 9999);
$key_num = rand(0, 16);
$hash_string = substr(md5($enc_num), $key_num, 5);
$hash_md5 = md5($hash_string);
$_SESSION['verify'] = $hash_md5;
// Verification Image Background Selection
$bgs = array('1.png');
$background = array_rand($bgs, 1);
// Verification Image Variables
$img_handle = imagecreatefrompng($bgs[$background]);
$text_colour = imagecolorallocate($img_handle, 255, 255, 255);
$font_size = 5;
$size_array = getimagesize($bgs[$background]);
$img_w = $size_array[0];
$img_h = $size_array[1];
$horiz = round(($img_w/2) - ((strlen($hash_string) * imagefontwidth(5))/2), 1);
$vert = round(($img_h/2) - (imagefontheight($font_size)/2));
// Make the Verification Image
imagestring($img_handle, $font_size, $horiz, $vert, $hash_string, $text_colour);
imagepng($img_handle);
// Destroy the Image to keep Server Space
imagedestroy($img_handle);
服務器機器正在使用Windows 8 –
要顯示驗證碼? @Eray –
是的,我在做@Subin –