Pear Class Call problem

Source: Internet
Author: User
Pear installed with the class, the default installation path, the call found in each class require_once (' xx '), ' xx ' does not exist in the specified directory, that is, the path is inconsistent, so call this class will be an error, why this? Do you want to go to the source of the installed class to modify the path of the calling class? Or is it another reason?


Reply to discussion (solution)

When Include_path is not set in php.ini, the Pear installation directory is included in the Include_path
If you specify include_path and you want to use pear, you should attach the Pear installation directory to include_path

Then you call the full path, such as require ("d:\x\xx\1.php");
Or first look at the results of Echo dirname (__file__),
Or use Get_include_path to confirm what the current inclusion path is



I understand that the original class of require_once (' xx ') inside the ' xx ' is relative to the php.ini set in the relative path of Require_path, so on, I understand wrong before, thought Require_ Once is relative to the current directory relative to the path, thank you upstairs two reminders

You understand nothing wrong!
The relative path to the embedded file is found in the directory specified by Include_path.

  • 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.