PHP包含在单独目录中的文件

时间:2016-03-23 00:14:24

标签: php

我有一个app文件夹,其中包含includespublic文件夹。

像这样:

app folder

包含文件夹包含以下文件:

bootstrap.php config.php

config.php包含以下代码:

<?php
return array(
        'host'      => 'localhost',
        'username'  => 'root',
        'password'  => '',
        'db'        => 'imagebox2016'
    );

boostrap.php包含以下代码:

<?php
// bootstrap code
$config = require_once 'config.php';
$dsn = "mysql:host=$config[host];dbname=$config[db]";

try {
    $dbh = new PDO($dsn, $config['username'], $config['password']);
} catch(PDOException $e) {
    echo 'Connection failed: ' . $e->getMessage();
}

public文件夹中有一个名为signup.php

的文件

它从这样开始并成功运行:

<?php
require_once '../includes/bootstrap.php';

我的问题是当我在boostrap.php中加入signup.php时,bootstrap.php成功地包含config.php的时间是{1}},而includesinclude_path文件夹?

PHP states

  

根据给定的文件路径包含文件,如果没有给出,则包含   指定的include_path。如果在。中找不到该文件   include_path,include将最终检入调用脚本自己的   失败前的目录和当前工作目录。该   如果找不到文件,include构造将发出警告

我没有修改我的function initialize() { var secheltLoc = new google.maps.LatLng(49.47216, -123.76307); var myMapOptions = { zoom: 15, center: secheltLoc, mapTypeId: google.maps.MapTypeId.ROADMAP }; var theMap = new google.maps.Map(document.getElementById("map_canvas"), myMapOptions); var marker = new google.maps.Marker({ map: theMap, draggable: true, position: new google.maps.LatLng(49.47216, -123.76307), visible: true }); var boxText = document.createElement("div"); boxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: white; padding: 5px; text-align: center;"; boxText.innerHTML = "Drag the map to re-center location"; var myOptions = { content: boxText, disableAutoPan: false, maxWidth: 0, pixelOffset: new google.maps.Size(-140, 0), zIndex: null, boxStyle: { background: "url('http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/examples/tipbox.gif') no-repeat", opacity: 0.75, width: "280px" }, closeBoxMargin: "10px 2px 2px 2px", closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif", infoBoxClearance: new google.maps.Size(1, 1), isHidden: false, pane: "floatPane", enableEventPropagation: false }; google.maps.event.addListener(marker, "click", function(e) { ib.open(theMap, this); }); var ib = new InfoBox(myOptions); ib.open(theMap, marker); } google.maps.event.addDomListener(window, 'load', initialize);

0 个答案:

没有答案