PHP Basic Learning-_file_ variable get Data directory

Source: Internet
Author: User
PHP Basic Learning--__file__ variable gets the directory where the file is located

?

DirName (DirName (__file__)); Get the file on the top of the directory name

such as:E:\PHP\wamp\www\testSource

str_replace (' \ \ ', '/', dirname (__file__))? ; Get a directory name on the file and replace it with a slash

E:/php/wamp/www/testsource

DirName (__file__); Gets the directory name of the file.

str_replace (' \ \ ', '/', substr (DirName (__file__), 0,-3)); get the name of the directory where the file is located and make a slash replace

such as:e:/php/wamp/www/testsource/src

?

>> data citation: Marie fashion: http://www.10086money.com

? (reprint please specify source: [Url=http://www.live588.org]*[/url])

?

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