<?php
$handle = fopen("pictures_list.txt", "r");
if ($handle) {
$linea = fgets($handle);
$lineb = fgets($handle);
$linec = fgets($handle);
}
fclose($handle);
else {
echo "can't find file";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pictures</title>
<link rel="stylesheet" type="text/css" href="cssstyles.css" />
</head>
<body>
<center>
<h1>Bridge Pictures</h1>
<br />
<p class="ex" align="justify">This site or call.</p>
<br/>
<h3> Click on image to zoom in. Place mouse on image for Time Stamp</h3>
<div id="container">
<ul>
<li>
<a href="<?php echo $linea; ?>">
<figure>
<img src="<?php echo $linea; ?>" width="400"/>
<figcaption> <?php echo $linea; ?> </figcaption>
</figure>
</a>
</li>
<li>
<a href="<?php echo $lineb; ?>">
<figure>
<img src="<?php echo $lineb; ?>" width="400"/>
<figcaption><?php echo $lineb; ?></figcaption>
</figure>
</a>
</li>
<li>
<a href="<?php echo $linec; ?>">
<figure>
<img src="<?php echo $linec; ?>" width="400"/>
<figcaption> <?php echo $linec; ?> </figcaption>
</figure>
</a>
</li>
</ul>
<span class="button prevButton"></span>
<span class="button nextButton"></span>
<br />
<h2><a href=" http://www.xyz/"> Click here for a list of all images </a></h2>
</ul>
</center>
</div>
<script src="jquery-1.4.2.min.js"></script>
<script>
$(window).load(function(){
var pages = $('#container li'), current=0;
var currentPage,nextPage;
var timeoutID;
var buttonClicked=0;
var handler1=function(){
buttonClicked=1;
$('#container .button').unbind('click');
currentPage= pages.eq(current);
if($(this).hasClass('prevButton'))
{
if (current <= 0)
current=pages.length-1;
else
current=current-1;
nextPage = pages.eq(current);
nextPage.css("marginLeft",-604);
nextPage.show();
nextPage.animate({ marginLeft: 0 }, 800,function(){
currentPage.hide();
});
currentPage.animate({ marginLeft: 604 }, 800,function(){
$('#container .button').bind('click',handler1);
});
}
else
{
if (current >= pages.length-1)
current=0;
else
current=current+1;
nextPage = pages.eq(current);
nextPage.css("marginLeft",604);
nextPage.show();
nextPage.animate({ marginLeft: 0 }, 800,function(){
});
currentPage.animate({ marginLeft: -604 }, 800,function(){
currentPage.hide();
$('#container .button').bind('click',handler1);
});
}
}
var handler2=function(){
if (buttonClicked==0)
{
$('#container .button').unbind('click');
currentPage= pages.eq(current);
if (current >= pages.length-1)
current=0;
else
current=current+1;
nextPage = pages.eq(current);
nextPage.css("marginLeft",604);
nextPage.show();
nextPage.animate({ marginLeft: 0 }, 800,function(){
});
currentPage.animate({ marginLeft: -604 }, 800,function(){
currentPage.hide();
$('#container .button').bind('click',handler1);
});
timeoutID=setTimeout(function(){
handler2();
}, 4000);
}
}
$('#container .button').click(function(){
clearTimeout(timeoutID);
handler1();
});
timeoutID=setTimeout(function(){
handler2();
}, 4000);
});
</script>
</body>
</html>
我的HTML和JavaScript似乎與硬編碼圖像的名字就好了以前的工作。我現在使用PHP從文本文件輸入圖像,但現在它似乎不工作。我知道本地主機當前無法處理此請求錯誤。
我試圖寫一個簡單的PHP程序,如這樣,這似乎工作得很好。我確信我錯過了很愚蠢的事情,但似乎無法弄清楚。請幫助
<?php
$handle = fopen("pictures_list.txt", "r");
if ($handle) {
$linea = fgets($handle);
$lineb = fgets($handle);
$linec = fgets($handle);
fclose($handle);
}
else {
echo "can't find file";
}
?>
<html>
<head>
</head>
<body>
<ul>
<li>
<a href="<?php echo $linea; ?>">
<figure>
<img src="<?php echo $linea; ?>" width="400"/>
<figcaption> <?php echo $linea; ?> </figcaption>
</figure>
</a>
</li>
<li>
<a href="<?php echo $lineb; ?>">
<figure>
<img src="<?php echo $lineb; ?>" width="400"/>
<figcaption><?php echo $lineb; ?></figcaption>
</figure>
</a>
</li>
</ul>
</body>
</html>
您是否嘗試過嘗試調試?死亡($ LINEA);確保圖像名稱仍然正確? –
當您遇到500錯誤時,您應該檢查服務器上的錯誤日誌,理由如下。 – Barmar