English 中文(简体)
PHP 包括进路问题
原标题:PHP Include Path Problems

设置包括道路确实使我感到困惑。 我必须失踪。

因此,我有以下公开的文字——我的服务器的链条。

    photoGallery.php
    header.php

我有一只手提存文件,把一个有以下结构的圆顶改用光彩。 php

RewriteRule ^gallery/([^/]+)/([0-9]+)-([^/]+)$ photoGallery.php?imageName=$2 [L]

......

http://localhost/gallery/roofing/1-picture-of-roofing

决心......

http://localhost/photoGallery.php?imageName=1

问题在于有一张PHP,包括在光盖里。 如果要改写URL的话,将无法解决问题。

    include  header.php 

因此,我要把“S”办法包括进去,以便解决任何问题。 这里我曾尝试过......

set_include_path(get_include_path() . PATH_SEPARATOR . "../../../");
include  header.php ;

我也试图确定这样的道路......

// get_include_path() returns .:/opt/lampp/lib/php
set_include_path(get_include_path() . PATH_SEPARATOR . "/opt/lampp/public_html");
include  header.php ;

我永远无法成功确定包括的道路。 我做了什么错误?

最佳回答

你可以尝试:

include($_SERVER[ DOCUMENT_ROOT ] .  /header.php );
问题回答

加入: http://php.net/manual/en/Function.getcwd.php to the same script as

set_include_path(get_include_path() . PATH_SEPARATOR . "/opt/lampp/public_html");

之后,根据原产(a)项调整“/opt/lampp/public_html”。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签