Jump to content

define function from other files


Ju-Pao

Recommended Posts

Is there a way in PHP to use the define function from another file in another directory in your PHP code?

 

For example my code is in this directory /home/dirA/dirB/dirC/

 

the the define function was from the directory /home/dirA/

                            define('KEYWORD',boi);

 

how can i use it in my code so that if I echo KEYWORD, it will display boi

without putting the define function in my code.

 

thank you guys for your help                   

Link to comment
Share on other sites

What you need to incorporate here is classes, you can have all your defined functions stored in a few scripts/directories then call them at will.  It's too big a topic to explain in one forum post, so what I suggest is that you look for a few tutorials / explanations on the net good luck ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.