Questions tagged [require-once]

The PHP require_once function

The PHP require_once function.

In contrast to require this function only includes the referred file if it has not been included before.

Use this tag only for questions that directly ask about require_once usage. Do not use this tag if your code contains require_once but you have no reason to believe that require_once is directly related to the issue you are asking about.

409 questions
-2
votes
2 answers

Why does the function require_once prevent my code from working

At the top of my code I have the following require_once 'PSBE_LOGIN'; where PSBE_LOGIN has all the information to access my database(I'm using a PDO connection). However, my code does not work but when I take it out, my code works perfectly. Any…
user3826764
  • 198
  • 1
  • 9
-2
votes
2 answers

PHP: "require_once" out of order

In my index.php I have: When I run this on my pc (using XAMPP) I get the result I want: the output of the three…
MPMP
  • 133
  • 1
  • 1
  • 10
-2
votes
1 answer

The difference between wrapping a require_once inside a conditional statement and not doing so in functions.php

Without the conditional statement: require_once( dirname( __FILE__ ) . "/edit_info_check_password.php" ); works fine. But by simple adding: if( substr($_SERVER["REQUEST_URI"], 18, 13) == "edit-userinfo" ) require_once( dirname( __FILE__ ) .…
Lawrence DeSouza
  • 984
  • 5
  • 16
  • 34
-2
votes
3 answers

duplicate php classes inside a file

I need to find a way to skip require_once error in case 2 php classes, with same name, are called in a file. I have 2 files a.php and b.php and each of them have class A declared inside. Inside index.php I first include a.php file which has class A…
1 2 3
27
28