如何在php中更改内容类型? [英] How to change content type in php?
问题描述
我有一张图片,但它不会显示。我检查图像属性(右键单击并选择属性),我发现类型是text / html而不是JPEG图像。这是因为导致我的图像的类型不显示?如何更改类型值?我正在使用php ...
我在一个简单的html [img]标签中显示图像......
<编辑:
是的,我试过..如果我包含
<?php header('Content-Type:image / jpeg'); ?>
显示网址,非常奇怪吧?
我正在使用apache,图像由php代码生成...
< img src =< ;?php echo bloginfo('template_url');?> /thumb.php?src =<?php echo get_post_meta($ post-> ID,image,$ single = true);?>& amp; h = 195& amp; w = 540& amp; zc = 1& amp; q = 95alt =<?php the_title();?>
header('Content-Type:image / jpeg');
确保在执行任何输出之前调用header()函数,否则您将收到已发送的标头 错误。
I have an image, but it keep doesn't display. I check the image properties (right-click and chose properties), and the I found the "type" is text/html not JPEG image. Is this because the type that cause my images dont show up?? How to change the "Type" value? I am using php...
I display the image in a simple html [img] tag...
EDIT:
Yeah, i tried.. If i include the
<?php header('Content-Type:image/jpeg'); ?>
It display the URL, very weird huh??
I am using apache, the image is generated by php code...
<img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo get_post_meta($post->ID, "image", $single = true); ?>&h=195&w=540&zc=1&q=95" alt="<?php the_title(); ?>
header('Content-Type: image/jpeg');
Make sure to call the header() function before doing any output or you will get a "Headers already sent" error.
这篇关于如何在php中更改内容类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!