HI, i have 2 php pages.first page has some functions like Connect(),... .i wa开发者_StackOverflow社区nt to use from Connect() function in second page but when use from Connect() can not recognize it.i use from header("first.php") but have same error. how can i solve that problem?
You need to include
the PHP file which contains your function(s).
In this case, if you're "index" page is called index.php
and your function, Connect()
is stored in functions.php
then you would do:
index.php
:
include "functions.php";
Connect();
Create a class contains that method and include in the page where u want
You don't tell us which error you get.
A solution would be to put all the functions you want to share in their own file, e.g. functions.php
and then use require
in both files to have access to those functions:
require 'functions.php';
精彩评论