Use phpexcel in yii

Source: Internet
Author: User

Phpexcel Ver: 1.7.9c

Referring to the example provided by phpexcel, it is basically no problem to generate an Excel file, mainly because the file inclusion in PHP is a bit complicated,

1) copy the phpexcel directory classes and all subdirectories and files under this directory to the components directory of yii.

2) modify the components/classes/phpexcel/autoloader. php file

    public static function Register() {        /*if (function_exists('__autoload')) {            //    Register any existing autoloader function with SPL, so we don't get any clashes            spl_autoload_register('__autoload');        }        //    Register ourselves with SPL        return spl_autoload_register(array('PHPExcel_Autoloader', 'Load'));*/        $functions = spl_autoload_functions();            foreach ( $functions as  $function)                spl_autoload_unregister($function);            $functions = array_merge(array(array('PHPExcel_Autoloader','Load')),$functions);            foreach ( $functions as $function)                $x = spl_autoload_register($function);            return $x;    }   //    function Register()

/**/Contains the original code, which can be replaced with uncommented code. Otherwise, an error of class undefined will occur.

Reference: http://hi.baidu.com/95857548/item/0130511b07297c532b3e2209

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.