search
Homephp教程php手册ie6 动态缩略图不显示的原因

ie6 动态缩略图不显示的原因

Jun 13, 2016 pm 12:23 PM
ie6imguploadNocodedynamicreasonexistcopyIhourshowgenerateofLink

我在上传生成缩略图时,缩略图显示的链接如下;

复制代码 代码如下:




结果在ie6下不显示该缩略图;后来追溯到下面一段代码:

复制代码 代码如下:


header("Content-type: image/jpeg") ;
header("Content-Length: ".strlen($_SESSION["fileInfo"][$image_id]));
echo $_SESSION["fileInfo"][$image_id];
unset($_SESSION['fileInfo'][$image_id]);//
exit(0);


于是就想是不是还来不及显示就被unset了?于是删掉就成功了。后来改为了如下代码:

复制代码 代码如下:


header("Content-type: image/jpeg") ;
header("Content-Length: ".strlen($_SESSION["fileInfo"][$image_id]));
echo $_SESSION["fileInfo"][$image_id];
/** 马上输出 上边的session,解决ie6下生成的缩略图在还没有显示前已经被下边的unset($_SESSION[''])清空,结果致使ie6无法显示缩略图的情况 */
echo $str . str_repeat(' ', 256); //有些浏览器必须要在输出达到256个字符时才肯输出
ob_flush();
flush(); // 这两个必须要一块用
unset($_SESSION['fileInfo'][$image_id]);//
exit(0);


其实这又引出了服务器的输出控制和浏览器的缓存问题,这有点复杂了,以后有机会再研究了。
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.