Jump to content
MakeWebGames

incuding a file


Danny696

Recommended Posts

I Was wodering what is the stafest way of including globas

the most common one is

<?php include "globals.php";

but ive seen things like

<?php include_once (DIRNAME(__FILE__) . '/globals.php');

and like

<?php include_once "globals.php';

and

<?php include("globals.php"); ?>

and

<?php include 'globals.php';

and

<?php include "$_SERVER['PHP_SELF'];"

and

<?php include($_SERVER['DOCUMENT_ROOT'] . '/globals.php');

 

mccodes normally uses the first one but i was wondering whats the best and safest way of doing it?

Link to comment
Share on other sites

Re: incuding a file

Well, consider this a question you should be asking your host.

Do they have open_basedir set? And is it pointed to the user's public_html, some host's don't allow file include's outside of public_html. So if open_basedir is set best is to:

 

include_once('globals.php');
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...