PHP can include Text/HTML from CGI but not from Text/CSS?
There's no problem to include cgi output with php except when it is Text/CSS. I tried to do so with:
<?php echo system('./cgi-bin/styl开发者_如何学Goegallery.cgi'); ?>
As you can see here, it returns blank: http://reboltutorial.com/gallery/stylegallery.php
whereas the cgi is returning something: http://reboltutorial.com/cgi-bin/stylegallery.cgi
I tried to add content-type:
<?php header("Content-type: text/css"); ?>
<?php echo system('./cgi-bin/stylegallery.cgi'); ?>
But nothing changed. Any idea why ? Thanks.
According to the PHP docs, system()
only returns the last line of output from your executed script.
The passthru()
function might be more suited for what you're trying to do.
精彩评论