Most voted "require" questions
37 questions
Sort by count of
-
41
votes3
answers57228
viewsWhat to use require/include/require_once/include_once?
I am developing an application in PHP and would like to know when and why to use require or include or require_once or include_once? I also noticed that you can make these shapes and it works:…
-
12
votes3
answers2583
viewsinclude, require inside functions methods
Use include (or require) within a function or method may cause some conflict or problem with older versions of PHP (such as 5.3)? I noticed that most frameworks working with MVC use require within a…
-
5
votes1
answer170
viewsRead files in a directory sorted by creation date
I have the following code to include all PHP files I find in a directory: if (is_dir(CONF_REL_PATH_BANANAS)) { foreach (glob(CONF_REL_PATH_BANANAS.'/*.php') as $file) { require_once($file); } } When…
-
3
votes1
answer200
viewsPhpstorm displays a message when using "include" and "require"
What reason my IDE Phpstorm, this message appears with include and require: Dynamic include Expression 'require_once $file' is not analysed. Include Expression is not resolved.…
-
3
votes2
answers283
viewsRequire and include
Hello I’m having a doubt on the following: Class: "Teste1.php" <?php class Teste1{}... ?> Ex1-include 'Teste1.php' Ex2- include_once 'teste1.php' Ex3- require_once 'Teste1.php' Is it possible…
-
2
votes3
answers988
viewsIs it possible to include more than one.php file in the path of a Require?
I didn’t know the best way to ask that question, but I came across the following question... Inside a document, I have some require_once (that I was mounting for a while), in the code they are this…
-
2
votes2
answers725
viewsWorking with directories to make a require in PHP
I have a page where I submit some information, stored in the Database. This page is inside 5 folders: pasta1/pasta2/pasta3/pasta4/pasta5. To the SELECT function, I need a require to make the…
-
2
votes1
answer460
viewsRequire Once / Include no Laravel
I’m trying to include a file on a page on a site made in Laravel. The file and page are on different servers. How can I do that? I tried with include and gave the following error : include():…
-
2
votes2
answers134
viewsHow do I delete the space that require_once leaves?
When I use the require_once to include the top of the site, it leaves a top space at the top of approximately 8px, even in CSS I using body{ padding: 0; margin: 0; border: 0; }; the problem remains.…
-
2
votes1
answer99
viewsNodejs: Difference between requests (require)
I started learning Nodejs and noticed that there are some ways to request a file, two of them are: const app = require('lib').app const {app} = require('lib') Is there any difference between them in…
-
2
votes3
answers189
viewsHow to properly make this condition?
I made this condition, so that if the person searches by name Andrey will run a require, otherwise it will not display, so any name I put in the search field is bringing the require, so is my code:…
-
2
votes1
answer581
viewsUse require() (or other method) in Nodejs as in PHP
In PHP Suppose I have a constant file, in a root directory, called const.php: define('CONST_1', BASE_CONST_1 || 'Value 1'); define('CONST_2', 'Value 2'); define('CONST_3', 'Value 3'); And another…
-
1
votes4
answers1237
viewsAccess config.php variables
I am a beginner in php and I have a problem, I have a config.php file this way: <?php $config['dbHostname'] = 'localhost'; $config['dbUser'] = 'teste'; $config['dbPassword'] = 'passteste'; But I…
-
1
votes1
answer851
viewsWhy does the require_once function work on the localhost but does not work on the server?
Dear I have a framework that accesses data from other servers, I programmed the entire system on localhost, on my machine. However, when playing for the server the external page call does not work,…
-
1
votes0
answers138
viewsUsing jQuery + Requirejs + Angularjs correctly
I’m trying to get the file themes/cms/build/js/main.min.jsfunction properly after being charged by Requirejs, but I haven’t been succeeding. The file is loaded, some functions works like…
-
1
votes1
answer22
viewsDoubt about require_once for multiple classes
Is there a way to require multiple classes using just one require_once? I believe that not then I was doing a function and another doubt arose, func_get_args returns an array?
-
1
votes1
answer4180
viewsImport functions from another file (Node.js)
I have a bot.js file that would be my "main" project and inside the same folder where the bot.js is.I have Call.js and Somar.js which are just functions [call()] and [add()]. It would be possible to…
-
1
votes1
answer208
viewsUsing require, where to use this tag?
I had asked this question before, but I was not so specific so I decided to reformulate my code here so that you understand better. Here I have the main file that will be used as template for all…
-
1
votes1
answer349
viewsPHP require_once without the need to pass the full path
I am with a legacy project, where all PHP files connect to the database through the file "oracle_ado.php" This file is in the folder ".. /inc/" and the rest in the folder ".. /Prod/". I am mounting…
-
1
votes2
answers1254
viewsrequire_once does not work
I’m trying to give require_once in a PHP file that has a class. The File I’m trying to include in PHP with the class has only one array with configuration data, but I can’t access it properly. class…
-
1
votes1
answer768
viewsPHP require() giving error 500
I have a system developed recently in PHP7 on Windows, and, I decided to migrate to Debian9. At the moment everything works, but the autoload (psr-4) located in vendor is having problems when…
-
1
votes1
answer174
viewsHow to add directories to search for modules in Lua?
I’m having a problem with require function, I want her to look for a moon file, but I don’t want to specify the folder, and my moon is installed on another disk, I’ll put a photo to see the error As…
-
1
votes0
answers60
viewsModule not located - "module xxx not found" - Lua lang
Archive: Player.lua, my module local Player = {} local function funcPlayer() local player = {} local self = {name="", points = 0} local setPoints = function(newPoints) self.points = newPoints end…
-
0
votes2
answers67
viewsWhy do requires and includes fail to add files that are in directories above the call file?
I realized that require and includes cannot include files that are above the call file directory. Because this occurs? Example: It works: <?php require_once('inc/configs.php'); ?> That doesn’t…
-
0
votes1
answer1005
viewsNo data was sent by server
When trying to access my route default in the browser is shown the error of the browser itself, in the case of Opera: The dev.local page is not working No data was sent by dev.local In the case,…
-
0
votes0
answers67
viewsRequire is unable to retrieve the file
Hello, no require error happens: Warning: require(./funcs/FuncSQL.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/Lucktor/pages/home.php on line 42 Fatal error:…
-
0
votes1
answer82
viewsrequire em Vue.js Component
Good afternoon I can’t use the "Next" require in the Vue Component file. How to resolve this? the file in question is home.js: const axios = require('axios'); Vue.component('home-page', { template:…
-
0
votes1
answer45
viewsDoubt Command Require
I’m trying to use the require command but this giving error, I’m trying to use in the following code: var Parser = require('C:/Users/gabri/OneDrive/Área de…
-
0
votes0
answers19
viewsWhat is "require" and "import" for in javascript?
I’m a beginner in JS and, during some readings for educational purposes to sites like Stack Overflow and Mozilla Documentation, I noticed commands like require() and import. I would like to know…
-
0
votes1
answer158
viewsProblem validating form fields as mandatory
staff needed to enter the fields of my form as required I did this via jQuery however I did not succeed the idea and get a red border in the fields that were not filled my code does not work dry…
-
0
votes0
answers3702
viewsUse of Undefined Constant
Well I was in the same trouble of that question, gave an answer to use define('ROOT_PATH', dirname(__FILE__));, (my problem without using this solution) but in mine it does not work. The following…
-
0
votes2
answers177
viewsproblem with PHP file path
Good evening, I’m having problems doing include of a file I use to register data in my database, I’m getting the error: Warning: require(./cadastro/usuario/usuario.php): failed to open stream: No…
-
0
votes0
answers18
viewsNodejs - initialize variables and they are available throughout the project
I’m having the following difficulty: I have the following design structure: my server.js is the start of the project. However, within the services, models, etc I have some libs, as an example log…
-
0
votes0
answers40
viewsWhat am I missing in this require?
I created a simple structure to train require, but it is showing error. What I am missing ? Structure, within C: xampp_htdocs SMB\ /file_pasta_Root.php /pasta_A/file_pasta_A.php…
-
-1
votes1
answer31
viewsI would like to display a txt file using JS or PHP respecting line break
I tried included and require, but they do not respect the line break. I want to print the file information inside a <p>, study-only.
-
-2
votes1
answer415
viewsMenu does not appear in mobile version
Good morning everyone, to finalizing a page that has an external menu, requested in PHP with require, I have also tried include, but still continues with the same problem, as images below the menu…
-
-2
votes0
answers21
viewsPHP - Require with Folders
I’m running a PHP test (probably the longest test I’ve ever done), where I try to get all the files from a folder, using require, but automatically... My files are like this: PHP-Teste index php.…