Workaround to deploy the Thinkphp project under IIS, the CAPTCHA cannot be displayed

Source: Internet
Author: User
Tags autoload

Since the company is renting virtual space and using an IIS server, there are a number of problems when deploying PHP: For example, we encountered this problem yesterday: Deploying the Thinkphp Project under IIS, the CAPTCHA cannot be displayed

Here's how to generate the verification code:

//making a special method to implement CAPTCHA generation    functionverifyimg () {//The following class verify did not include the introduction//Walk auto-load Think.class.php autoload ()        $config=Array (                ' Usenoise ' =false, ' imageh ' = 35,//Verification Code Picture height' Imagew ' = ' = ', ' fontSize ', ' = ', ' Fontttf ' and ' 4.ttf ',//captcha font, not set random get' Length ' = 4         ) //Verify number of code bits; $verify=New\think\verify ($config ); $verify-entry (); }

Then Apache under can, but under IIS is not, see the internet said the most is to get rid of the BOM head on it, but I use the UE to save without BOM header or not

Today finally solved:

Before generating the verification code: add Ob_clean

//making a special method to implement CAPTCHA generation    functionverifyimg () {//The following class verify did not include the introduction//Walk auto-load Think.class.php autoload ()        $config=Array (                ' Usenoise ' =false, ' imageh ' = 35,//Verification Code Picture height' Imagew ' = ' = ', ' fontSize ', ' = ', ' Fontttf ' and ' 4.ttf ',//captcha font, not set random get' Length ' = 4         ) //Verify number of code bits; Ob_clean(); $verify=New\think\verify ($config ); $verify-entry (); }

OK, of course, these are on the premise of opening the GD library

Workaround to deploy the Thinkphp project under IIS, the CAPTCHA cannot be displayed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.