require-once

Using require_once for up directory not working

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 05:00:02
问题 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 admin. Inside admin folder I have a file called admin.php. I want to require file yves-slider.php in my admin.php which is located up one level directory. When I try to use require_once('../yves-slider.php') it gives me the following error Warning: require_once(../yves-slider.php): failed to open

PHP find require_once real path

本小妞迷上赌 提交于 2019-11-29 02:38:26
i need to require_once this files main.class.php and functions.php and config.php to admin/test.php . how to php find require real path?! NOTE: main.class.php in class folder , functions.php in includes folder and config.php in root directory and test.php in admin folder . File Directory: root /admin/ ->test.php /class/ ->main.class.php /includes/ ->functions.php /templates config.php phpinfo.php I would add your root folder to the include path and work from there. From admin/test.php set_include_path(implode(PATH_SEPARATOR, array( realpath(__DIR__ . '/..'), get_include_path() ))); require

relative path in require_once doesn't work

限于喜欢 提交于 2019-11-27 02:59:52
I have the following structure otsg > class > authentication.php > database.php > user.php > include > config.inc.php > encryption.php > include.php > session.php > index.php > registration.php include.php file has the following ini_set('display_errors', 1); error_reporting(E_ALL); ini_set('include_path',ini_get('include_path').':/Applications/MAMP/htdocs/otsg/:'); require_once 'config.inc.php'; require_once '../class/database.php'; require_once '../class/user.php'; require_once 'encryption.php'; require_once 'session.php'; require_once '../class/authentication.php'; and in the index.php page

relative path in require_once doesn't work

这一生的挚爱 提交于 2019-11-26 10:19:56
问题 I have the following structure otsg > class > authentication.php > database.php > user.php > include > config.inc.php > encryption.php > include.php > session.php > index.php > registration.php include.php file has the following ini_set(\'display_errors\', 1); error_reporting(E_ALL); ini_set(\'include_path\',ini_get(\'include_path\').\':/Applications/MAMP/htdocs/otsg/:\'); require_once \'config.inc.php\'; require_once \'../class/database.php\'; require_once \'../class/user.php\'; require_once

Why is require_once so bad to use?

醉酒当歌 提交于 2019-11-26 01:49:02
问题 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 matters, I\'m using PHP 5. 回答1: require_once and include_once both require that the system keeps a log of what's already been included/required. Every *_once call means checking that log. So there's definitely some extra work being done there but enough to detriment the speed of the whole app? ... I

Difference between require, include, require_once and include_once?

牧云@^-^@ 提交于 2019-11-25 21:52:40
问题 In PHP: When should I use require vs. include ? When should I use require_once vs. include_once ? 回答1: There are require and include_once as well. So your question should be... When should I use require vs. include ? When should I use require_once vs. require The answer to 1 is described here. The require() function is identical to include(), except that it handles errors differently. If an error occurs, the include() function generates a warning, but the script will continue execution. The