/    Sign up×
Community /Pin to ProfileBookmark

Could someone explain these please

  • 1. require_once(dirname(__FILE__).’/config.php’);
  • I know __FILE__ is a constant of some sort but how and why is it being used in the above?

    dirname() ?

    to post a comment
    PHP

    2 Comments(s)

    Copy linkTweet thisAlerts:
    @bokehDec 02.2005 — The two easy ways to figure something out in PHP is either echo it:[code=php]echo dirname(__FILE__).'/config.php';[/code]Or consult the manual: [URL=http://es2.php.net/dirname]dirname()[/URL] and [URL=http://es2.php.net/manual/en/language.constants.predefined.php]__FILE__[/URL]
    Copy linkTweet thisAlerts:
    @NogDogDec 02.2005 — __FILE__ is the full pathname of the file currently being processed. If used within an included file, it returns the pathname of the included file, not the calling file, which might be important in this case and the reason it is being used.

    dirname() simply returns the path to the directory in which __FILE__ resides (essentially just trimming the filename off from the full pathname).
    ×

    Success!

    Help @solidariti spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.16,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...