For example i have a file file1.php
:
Now, i have another php file file2.php
in which i am including in file1.php
:
include "file1.php";
I don't want some code to include. Is there any way or function to restrict that code to include?
For example i have a file file1.php
:
Now, i have another php file file2.php
in which i am including in file1.php
:
include "file1.php";
I don't want some code to include. Is there any way or function to restrict that code to include?
Convert that code block to function(in first file) that you don't want to execute in second file, this will execute only if you call that function otherwise not
TRY this : In you file1.php add all code in small functions. Then call only those function in file2.php which is needed . You can also use Oops Concept create class and call needed method only .
file1.php
method1();
mehtod2();
method3();
file2.php
include file.php
method1();
Sorry : You have to use oops concept in PHP .