Reputation: 31
I want to use include straight in define in php
for e.g.
<?php define('panel' , 'include "../panel/admin.php";'); //in a saperate php page ?>
and include this file
Now I want use
<?php panel ?> //in another page
Upvotes: 0
Views: 102
Reputation: 6539
mohade's answer is correct.
However you can do the same with your existing code by below way.
define('panel' , 'include "/panel/admin.php";');
eval(panel); // eval — Evaluate a string as PHP code
Hope it will help you :)
Upvotes: 0
Reputation: 1637
you cant use include() in define
you must do this
<?php define("panel" , "../panel/admin.php"); ?>
and then include it
<?php
include(panel);
?>
Upvotes: 8