1

I want to know if and how I can define a file to be included.

for e.g.

<?php
//define('_login',inlcude('file.php'));
define('_login',include('file.php')); // edited due to typo..
?>

or would I need to do it this way

<?php
define('_login','file.php');
include(_login);
?>

the reason I ask is My site allows plugins and I want other developers to overwrite a define to include their plugin instead of the core _login define.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
RussellHarrower
  • 6,470
  • 21
  • 102
  • 204

2 Answers2

1

This one should be Ok:

<?php
define('_login','file.php');
include(_login);
?>

Event can't imagine what will happen in first case. Maybe if you return something from file - that value will be used?

Viktor S.
  • 12,736
  • 1
  • 27
  • 52
0

you have to use it like this

<?php
// works
if ((include 'vars.php') == 'OK') {
    echo 'OK';
}
?>

http://php.net/manual/en/function.include.php

Yogesh Suthar
  • 30,424
  • 18
  • 72
  • 100