How to use Ziparchive new when thinkphp 3.2.3 prompt to find the class php5.5.12 the default is to open the zip ah?

Source: Internet
Author: User
Tags ziparchive
I'm afraid I don't know what to say. Phpinfo view is open zip Ah



View PHP official documentation see that everyone else is directly new.

$zip = new Ziparchive;

This class is not an extension installed directly can be used
thinkphp3.2.3

Public  function  Tozip () {        $zip =new ziparchive;        Dump ($zip);    }

I'm not suggesting I can't find the class amount.

:(
Class ' home\controller\ziparchive ' not found
Wrong location
file:d:\wamp\www\apps\home\controller\picturecontroller.class.php line:244

I see in the PHP documentation that the requirements are
(PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
It's supposed to be available. 5.5.12 also integrates the given example is also direct new's Ask me where's the problem?


Reply to discussion (solution)

This is because of the reason you used the namespace
The Ziparchive class is a PHP built-in class and not in Home\controller
When you use it, add \
$zip =new \ziparchive;
You can do it.

This is because of the reason you used the namespace
The Ziparchive class is a PHP built-in class and not in Home\controller
When you use it, add \
$zip =new \ziparchive;
You can do it.


Thank you I also just want to understand ~ Thank you very much reply ~
  • 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.