This string of code, cannot display the picture in the Linux environment
$img_url = $_GET['img'];$content = file_get_contents($img_url);header('Content-Type: image/jpeg; charset=UTF-8');echo $content;
Linux Environment Access address demo (there is a problem)
MAC Environment Access address demo (normal)
Win off the machine will not post (normal)
I've added no errors before this string error_reporting(E_ALL);ini_set("display_errors","On");die;
of code,
Check the Linux environment allow-url-fopen
for on
, and can print_r
come out, the same content as follows:
����JFIF��;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90 ��C ��C ��j�"�� ���}!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������� ���w!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������?�����2���}x����bi��f(�IQ߆���]/�?
This string of characters does not make much sense, the interception of a section of the head posted up.
Also add a phpinfo for everyone to view
Reply content:
This string of code, cannot display the picture in the Linux environment
$img_url = $_GET['img'];$content = file_get_contents($img_url);header('Content-Type: image/jpeg; charset=UTF-8');echo $content;
Linux Environment Access address demo (there is a problem)
MAC Environment Access address demo (normal)
Win off the machine will not post (normal)
I've added no errors before this string error_reporting(E_ALL);ini_set("display_errors","On");die;
of code,
Check the Linux environment allow-url-fopen
for on
, and can print_r
come out, the same content as follows:
����JFIF��;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90 ��C ��C ��j�"�� ���}!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������� ���w!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������?�����2���}x����bi��f(�IQ߆���]/�?
This string of characters does not make much sense, the interception of a section of the head posted up.
Also add a phpinfo for everyone to view
This problem is resolved at three o'clock last evening, added before the code output, ob_clean
there will be unexpected output in thinkphp debug mode, but what this output is not yet found, and this unexpected output is only available under Linux, suspect that there is a problem between the framework and the system configuration.
Normally, you should be able to output images. Under Windows, I tested without problems. Thinkphp may have some application to the OB cache, clean it up, or there may be a problem with the output binary stream directly in the browser.
Less expansion
Freetype,jpegsrc,libpng, try it on.
Header (' content-type:image/jpeg; Charset=utf-8 ');
This line removes charset=utf-8.
Header (' Content-type:image/jpeg ');
Look, LZ's corresponding head is Content-Type: image/jpg
, should be Content-Type: image/jpeg
.