Php HTTP错误500,不确定从何处开始
我意识到这可能不是最好的代码,但我正在努力。 我很想知道我在哪里出错,而不是寻找我的代码是否已修复。更改Php HTTP错误500,不确定从何处开始,php,Php,我意识到这可能不是最好的代码,但我正在努力。 我很想知道我在哪里出错,而不是寻找我的代码是否已修复。更改 <?php $tabel = array(); $teller = 0; $handle = opendir(dirname(realpath(__FILE__)).'/images/bbq2015/'); while($file = readdir($handle)){ if($file !== '.' &&am
<?php
$tabel = array();
$teller = 0;
$handle = opendir(dirname(realpath(__FILE__)).'/images/bbq2015/');
while($file = readdir($handle)){
if($file !== '.' && $file !== '..'){
$tabel[$teller] = $file;
$teller++;
}
}
$n = $tabel.length();
for ($i = 0; $i < $n-1; $i++)
for ($j = 0; $j < $n-$i-1; $j++)
if ($tabel[$j] > $tabel[$j+1])
{
$temp = $tabel[$j];
$tabel[$j] = $tabel[$j+1];
$tabel[$j+1] = $temp;
}
$teller = 0;
while($teller < $n){
echo '<a class="example-image-link" href="images/bbq2015/'.$tabel[$teller].'" data-lightbox="example-set" data-title="BBQ 2015"><img class="halloween2015" src="images/bbq2015/'.$tabel[$teller].'"/></a>';
$teller++;
}
?>
到
count()返回数组中的元素数
可能从错误报告开始?你可以等一段时间,有人会发一篇很长的帖子,回答说请在
$n=tabel.length()中添加一个$
将获得相当多的投票,并且会有非常好的评论,但仍然是错误的:PYup我的猜测是$n=tabel.length();是的,因为这是JS,在PHP中,您将执行$n=count($arrayName)代码>ini设置(“显示错误”,1);错误报告(E_全部)代码>在
$n= $tabel.length(); //there is no length() function in PHP
$n= count($tabel);