require-once Questions

8

Solved

I'm looking for a way to set the scope of require_once() to the global scope, when require_once() is used inside a function. Something like the following code should work: file `foo.php': <?ph...
Comedietta asked 23/1, 2012 at 15:2

28

Solved

In PHP: When should I use require vs. include? When should I use require_once vs. include_once?
Hendecagon asked 10/3, 2010 at 16:13

5

I have the following file structure -- Plugins -- inParent.php ---- Uploadify ------ inSame.php ------ Uploadify.php This function was working smoothly till yesterday. But now, If I try to includ...
Positronium asked 3/9, 2012 at 6:29

4

Solved

I am working on a PHP script which involves me including several external PHP scripts via the "require_once()" method. I would like to know if there is a way for the master script (the one includin...
Zemstvo asked 6/4, 2011 at 2:12

4

Solved

Recent versions of PHP have a cache of filenames for knowing the real path of files, and require_once() and include_once() can take advantage of it. There's a value you can set in your php.ini to s...
Wenonawenonah asked 13/10, 2008 at 14:19

5

Solved

Is this just a stylistic difference, or does using require_once('filename.php') vs require_once 'filename.php' have actual load/efficiency differences?
Ohalloran asked 3/8, 2010 at 5:37

3

Solved

I have a web site made by wordpress and I made some php files that i want to execute and for some reason I need to require_once(/wp-includes/class-phpass.php) but I got Failed opening required Erro...
Unborn asked 16/10, 2014 at 21:30

4

Solved

I would like to require a file but also pass GET variables through the url, but when I write: <?php require_once("myfile.php?name=savagewood"); ?> I get a fatal error. How would I accompl...
Darcie asked 24/4, 2011 at 17:6

4

Solved

Simple question: Is the scope of require_once global? For example: <?PHP require_once('baz.php'); // do some stuff foo ($bar); function foo($bar) { require_once('baz.php'); // do differen...
Olympia asked 21/4, 2010 at 0:31

3

I am using as a beginner : Eclipse IDE for PHP Developers Version: Photon Release (4.8.0) Build id: 20180619-1200 OS: Windows 10, v.10.0, x86_64 / win32 Java version: 1.8.0_77 I have a file index....
Dunnage asked 1/7, 2018 at 19:31

4

Solved

I have the following structure otsg > class > authentication.php > database.php > user.php > include > config.inc.php > encryption.php > include.php > session.ph...
Angwantibo asked 20/3, 2011 at 22:1

5

Solved

I was writing an web app in PHP, when I encountered a strange situation. To illustrate my problem, consider a web app of this structure: / index.php f1/ f1.php f2/ f2.php Contents of these ...
Goodard asked 29/12, 2009 at 9:59

5

Solved

I have a block of code that I need to use in so many places of my app. Example: $count_device = VSE::count_device($cpe_mac); $c_devices = $count_device['Count_of_devices']; $c_active = $count_devic...
Saldivar asked 31/10, 2016 at 16:4

2

Solved

I am trying to require my "library" files from php files in different folders, but it gives errors when trying to access them from a subfolder. For example I have such a directory: + home - file1...
Cachexia asked 8/2, 2013 at 15:53

1

im a beginner with doctrine. I just installed pear + doctrine 2.3.3 and want to test it. to test doctrine i wrote a class named "person" /** * @Entity */ class person { /** @Id @Column(type="i...
Crust asked 16/10, 2012 at 14:28

3

Solved

After we add a file inside Myfile.php with: require_once 'abc.php'; or include_once 'abc.php'; How we will remove the file? Or how to stop the abc.php file content being accessed after a cer...
Herwick asked 26/6, 2014 at 17:16

5

Solved

Let's say I have the following situation: File1.php: <?php require_once('init.php'); ... ?> File2.php: <?php require_once('init.php'); ... ?> init.php: <?php magic_function_w...
Cabbage asked 13/5, 2015 at 14:18

14

Solved

Everything I read about better PHP coding practices keeps saying don't use require_once because of speed. Why is this? What is the proper/better way to do the same thing as require_once? If it ma...
Carnarvon asked 9/10, 2008 at 8:3

11

Solved

My webapp has a buch of modules. Each module has a 'main' php script which loads submodules based on a query sent to the main module: //file: clientes.php //check for valid user... //import...
Mydriatic asked 28/12, 2010 at 12:4

1

Solved

I already know that include_once would return true or false based on including that file. I've read a question on Stackoverflow about using require_once to return your value and print it out. The...
Flyblow asked 8/10, 2014 at 13:14

2

Solved

I am using a php library which has this code: require_once dirname(__FILE__) . '/config.php'; From what I've read, dirname(__FILE__) points to the current directory. So wouldn't it be easier to j...
Doubleton asked 15/1, 2014 at 21:12

1

Solved

I'm trying to run my online site on my local machine. I stumbled upon a problem. This is my htaccess AddDefaultCharset UTF-8 Options -Indexes #php_value include_path .:/home/sites/www.example.it/...
Cumulative asked 15/1, 2014 at 9:2

11

Solved

I've switched my files over from a local environment to my vps and now my facebook notification isn't working even thought I'm pretty sure I've updated all the paths correctly. I've tried writing t...
Nolde asked 6/11, 2013 at 21:27

7

I have Folder Home with two subfolders like the following +Home +include - membersite_config.php +iDiscover -index.php in index.php I added the require_once script to access members...
Forefather asked 24/2, 2013 at 7:22

1

Solved

I am using require_once like this require_once('../mycode.php') I am developing a wordpress plugin. My plugin folder is yves-slider where I have a file called yves-slider.php and a folder called...
Erysipeloid asked 6/1, 2013 at 16:35

© 2022 - 2024 — McMap. All rights reserved.