Jump to content

php require_once not working


dfqaz

Recommended Posts

im writing php application in windows 7 using apachi . iwant to include php file to another php file. This is the code.

test.php

-------------

before

 

<?php require_once 'footer.php'; ?>

 

after

 

 

fotter.php

--------------

test 1 ------------------------- test2

 

 

when I include the above footer.php into test.php file I got the following result.

 

 

before

 

<?php require_once 'footer.php'; ?>

 

after

 

Could you please tell me wher i goes woring?

Link to comment
https://forums.phpfreaks.com/topic/236435-php-require_once-not-working/
Share on other sites

@anupamsaha

when I type ur code in top of my code. It removed code

Put the following at the top of your PHP code and see what errors are you getting:

 

error_reporting(E_ALL);
ini_set("display_errors", 1);

 

Thanks!

 

Thanx. When I insert ur code  I got only the `before` and `after` words without

<?php require_once 'footer.php'; ?>

. But it is not included my footer file.

 

This is my code agin...

 

 

test.php

before

<?php require_once 'footer.php'; ?>

after


 

footer.php

test 1 ------------------------- test2 

 

 

results ahould be

before
test 1 ------------------------- test2 
after

 

Please help me...

In order to run PHP code on your computer you need to install a http server (IIS or Apache) which is configured with PHP. Simply just loading test.php directly into your web browser will not work.

 

If you have installed a Server that is configured with PHP then make sure you are saving the php files in your servers root folder and going to http://localhost/test.php to run it.

 

 

Archived

This topic is now archived and is closed to further replies.

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