require-once

AWS SDK PHP Class Not Found

雨燕双飞 提交于 2019-12-13 19:11:30
问题 When I am use the AWS SDK with php I get an error stating that the class cannot be found. <?php require_once '/var/www/html/aws.phar'; use Aws\Common\Aws; use Aws\Common\Enum\Region; echo "test"; $AWSregion = Region::US_EAST_1; $aws = Aws\Common\Aws::factory(array('key'=>'key', 'secret' => 'secret_key', 'region' => $AWSregion)); $client = $aws->get('Sqs'); ?> The exact error message I receive is PHP Fatal Error: Class 'Aws\Common\Enum\Region' not found in /var/www/html/sendSQS.php Any help is

require_once connect to other website

别来无恙 提交于 2019-12-13 09:09:56
问题 I'm trying to get my visitor when they visit my site to auto connect to the other site once I did put this <?php require_once("http://webtoconnect.com"); ?> but I guess this code wouldn't work it just give me an error something like this Warning: require_once() [function.require-once]: URL file-access is disabled in the server configuration in /home/yoursn0w/public_html/tv/index.php on line 1 so I wonder how can I do to get my visitor stay in the same page but auto connect once to the site I

how to pass variables between 2 php pages when the latter called with require()

匆匆过客 提交于 2019-12-13 03:18:00
问题 I am a PHP newbie, and I have this question: say I have: a.php: $a = 'foo' ; $b = 'baz' ; require ('b.php') ; How do I pass variables $a and $b to b.php ? How do I use these variables in b.php ? thanks a lot !! 回答1: Just make sure you call require() after setting the variables, and they should be available in b.php. a.php: $a = 'foo'; $b = 'baz'; require('b.php'); b.php: echo 'a: '. $a; echo 'b: '. $b; 回答2: You can use these variables straight away in b.php require(), include(), etc...

Require_once and fopen in php security

我是研究僧i 提交于 2019-12-12 03:48:56
问题 I have 1 file that i've implemented in PHP. Error that i get is Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /Applications/MAMP/htdocs/opencart/catalog/view/theme/default/template/payment/bank_transfer.tpl on line 13Warning: Questions: I know that i need to fix this by allowing allow_url_include=0, in php.ini.I'm using MAMP, i've searched all the folders in MAMP and MAMP Pro, but i didn't find any line, where i can set that value

require_once in php

試著忘記壹切 提交于 2019-12-11 07:00:37
问题 I have a php file which has a require_once Statement (?) this file is then in included in 2 other php files, one php file is in a sub directory so the layout is like this ("file1" and "file2" include the file "included" which require_onces the "required")# L--subfolder1 | L--file1 L--subfolder2 | L--required L--file2 L--included How can I reference the "required" file from the "included" file so that it will work from both file1 and file2? 回答1: always use absolute path $_SERVER['DOCUMENT_ROOT

PHP adds extra whitespace on require

爱⌒轻易说出口 提交于 2019-12-11 06:33:58
问题 Consider the following code: <div id="sidebar"> <?php require_once('/components/search.php'); require_once('/components/categories.php'); ?> </div> search.php and category.php are essentially the same structure - a div container with some specific contents. Nothing special here, pure HTML: <div class="component"> <!-- blah --> </div> However, when inserted with require_once (or require / include etc), PHP adds whitespace above each element, pushing it down, identifiable as an empty text node

required_once issue in Google API Client for PHP

拟墨画扇 提交于 2019-12-10 19:45:44
问题 I have been trying to import/include file in my php script file and somehow it is not working. I know this require_once question has been asked so many times [ 1. require_once with subfolders , 2. require_once() cant find the include path, 3. Using require_once for up directory not working] but none of them seemed to be working for me. Blow picture will explain what I am trying to do clearly: What I tried and errors: Attempt 1 require_once(__DIR__.'GoogleClientApi/src/Google/Service/Analytics

“Fatal error: Cannot redeclare class” … but the class was not declared

余生长醉 提交于 2019-12-10 16:13:08
问题 (I'm using Joomla v1.5.15 and PHP 5.3.4) I have tested the solutions found in this and others developer forums, but I still having the same error. Requiring file => contratolocal.php ... if ( !class_exists('MTIHelperEstadosLocal') ) JLoader::import('helpers.estados.estadoslocal', JPATH_COMPONENT, false); class MTIControllerContratoLocal extends MTIController { ... Required file => estadoslocal.php ... class MTIHelperEstadosLocal extends MTIHelperEstados { ... "JLoader::import" is used

php require_once not working the way I want it to.. relative path issue

烂漫一生 提交于 2019-12-10 10:08:49
问题 I'm having problems assigning a relative path to require_once. I'm sure it's something simple that I'm not seeing... folder directory structure level 1: site level 2: include level 2: class so... site/include/global.php <-- this is where function autoload is being called from site/class/db.php when I attempt to use function__autoload($className) { require_once '../class/'.$className.'.php'; } i get: Warning: require_once(../class/db.php) [function.require-once]: failed to open stream: No such

Is there a way to set the scope of require_once() explicitly to global?

删除回忆录丶 提交于 2019-12-09 14:38:51
问题 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': <?php $foo = 42; actual code: <?php function includeFooFile() { require_once("foo.php"); // scope of "foo.php" will be the function scope } $foo = 23; includeFooFile(); echo($foo."\n"); // will print 23, but I want it to print 42. Is there a way to explicitly set the scope of require_once() ? Is there a nice