Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php使图像可点击_Php_Image_Click - Fatal编程技术网

php使图像可点击

php使图像可点击,php,image,click,Php,Image,Click,需要一些帮助使我的图像可点击。我已经尝试了一切,每当我做的图像打破,不会显示。该代码是在网站上提供的,我试图将分页添加到我的页面中,现在单击图像并搜索图像时出现另一个错误 while( $file = readdir( $open ) ){ $ext = strtoupper( pathinfo( $file, PATHINFO_EXTENSION ) ); if( in_array( $ext, $allow ) ){ $modifyTime = filemtime( $

需要一些帮助使我的图像可点击。我已经尝试了一切,每当我做的图像打破,不会显示。该代码是在网站上提供的,我试图将分页添加到我的页面中,现在单击图像并搜索图像时出现另一个错误
while( $file = readdir( $open ) ){

  $ext = strtoupper( pathinfo( $file, PATHINFO_EXTENSION ) );

  if( in_array( $ext, $allow ) ){

    $modifyTime = filemtime( $dir . $file );
    $list[ $modifyTime ] = $file;

  }
}

# reverse sort on key
krsort( $list );

$perPage  = 20;
$total    = count($list);
$pages    = ceil($total/$perPage);
$thisPage = isset($_GET['pg'])?$_GET['pg']-1:0;
$start    = $thisPage*$perPage;

echo "Page "; 

// show pages
for ($i=0;$i<$pages;$i++):

  if ($i==$thisPage) :
    print "&nbsp;".($i+1); 
  else :
    print "&nbsp;<a href='?pg=".($i+1)."'>".($i+1)."</a>"; 
  endif;

endfor;

// show images
$items = array_slice( $list, $start, $perPage );
foreach( $items as $image ){
  echo "<a href='$dir/$file'<br/> " . $image . "<br/><img width='200' height='200' src='" . $urlPath . $image . "'/><br/></";
}

closedir($open);  
?>
while($file=readdir($open)){
$ext=strtoupper(pathinfo($file,pathinfo_扩展名));
if(在数组中($ext$allow)){
$modifyTime=filemtime($dir.$file);
$list[$modifyTime]=$file;
}
}
#按键反向排序
krsort($列表);
每页$20;
$total=计数($list);
$pages=ceil($total/$perPage);
$thisPage=isset($\u GET['pg'])?$\u GET['pg']-1:0;
$start=$thisPage*$perPage;
呼应“页面”;
//显示页面
对于($i=0;$i)
类似于:

echo( "<a href='$dir/$file'><img width='200' height='200' src='$urlPath/$image'/></a>") ;
echo(“”);
-您的“
-$urlPath和$image之间没有“/”(或者$urlPath字符串中的“/”是否类似于:

echo( "<a href='$dir/$file'><img width='200' height='200' src='$urlPath/$image'/></a>") ;
echo(“”);
-您的“
-$urlPath和$image之间没有“/”(或者$urlPath字符串中的“/”是否类似于:

echo( "<a href='$dir/$file'><img width='200' height='200' src='$urlPath/$image'/></a>") ;
echo(“”);
-您的“
-$urlPath和$image之间没有“/”(或者$urlPath字符串中的“/”是否类似于:

echo( "<a href='$dir/$file'><img width='200' height='200' src='$urlPath/$image'/></a>") ;
echo(“”);
-您的“

-$urlPath和$image之间没有“/”(或者$urlPath字符串中是否有“/”)

您没有在引号中正确转义变量:

echo '<a href="' . $urlPath . '/' . $image . '"><img src="' . $urlPath . '/' . $image . '" width="200" height="200" /></a>';
echo';

您没有在引号中正确转义变量:

echo '<a href="' . $urlPath . '/' . $image . '"><img src="' . $urlPath . '/' . $image . '" width="200" height="200" /></a>';
echo';

您没有在引号中正确转义变量:

echo '<a href="' . $urlPath . '/' . $image . '"><img src="' . $urlPath . '/' . $image . '" width="200" height="200" /></a>';
echo';

您没有在引号中正确转义变量:

echo '<a href="' . $urlPath . '/' . $image . '"><img src="' . $urlPath . '/' . $image . '" width="200" height="200" /></a>';
echo';


最后的
echo
语句中有些粗枝大叶可能是罪魁祸首。至少缺少一个
和一个
a>
mopo922这是我的错//是我试图制作图像clickable@Eddie_如果你把它清理干净会发生什么?看起来开始和结束标记都不完整。@mopo922 sa我的事情发生了,没有显示图像生成的源代码是什么样子的,它应该是什么样子的(路径正确,等等)?最后的
echo
语句有点马虎,可能是罪魁祸首。缺少至少一个
和一个
a>
mopo922这是我的错//是我试图制作图像clickable@Eddie_如果你清理它会发生什么?看起来开始和结束标记都不完整。@mopo922相同ng碰巧没有显示图像生成的源代码是什么样子的,它应该是什么样子的(路径正确,等等)?最后的
echo
语句有点马虎,可能是罪魁祸首。缺少至少一个
和一个
a>
mopo922这是我的错//是我试图制作图像clickable@Eddie_如果你清理它会发生什么?看起来开始和结束标记都不完整。@mopo922相同ng碰巧没有显示图像生成的源代码是什么样子的,它应该是什么样子的(路径正确,等等)?最后的
echo
语句有点马虎,可能是罪魁祸首。缺少至少一个
和一个
a>
mopo922这是我的错//是我试图制作图像clickable@Eddie_如果你清理它会发生什么?看起来开始和结束标记都不完整。@mopo922相同ng碰巧没有显示图像生成的源代码是什么样子的,它应该是什么样子的(路径正确,等等)?它将其发送到“上载”目录文件夹而不是单击的图像我已经编辑了我的答案。如果你想让他们在单击图像时转到该图像,你需要锚的href与图像的路径相同。它会将其发送到“上载”目录文件夹而不是单击的图像我已经编辑了我的答案。如果你想让他们在单击图像时转到该图像,你需要锚的href与图像的路径相同。它会将其发送到“上载”目录文件夹而不是单击的图像我已经编辑了我的答案。如果你想让他们在单击图像时转到该图像,你需要锚的href与图像的路径相同。它会将其发送到“上载”目录文件夹而不是单击的图像我已经编辑了我的答案。如果你想让他们在单击图像时转到图像,你需要锚的href与图像的路径相同。
while( $file = readdir( $open ) ){

  $ext = strtoupper( pathinfo( $file, PATHINFO_EXTENSION ) );

  if( in_array( $ext, $allow ) ){

    $modifyTime = filemtime( $dir . $file );
    $list[ $modifyTime ] = $file;

  }
}

# reverse sort on key
krsort( $list );

$perPage  = 20;
$total    = count($list);
$pages    = ceil($total/$perPage);
$thisPage = isset($_GET['pg'])?$_GET['pg']-1:0;
$start    = $thisPage*$perPage;

echo "Page "; 

// show pages
for ($i=0;$i<$pages;$i++):

  if ($i==$thisPage) :
    print "&nbsp;".($i+1); 
  else :
    print "&nbsp;<a href='?pg=".($i+1)."'>".($i+1)."</a>"; 
  endif;

endfor;

// show images
$items = array_slice( $list, $start, $perPage );
foreach( $items as $image ){
  echo "<a href='$dir/$file'<br/> " . $image . "<br/><img width='200' height='200' src='" . $urlPath . $image . "'/><br/></";
}

closedir($open);  
?>