是否有一个等效于<base href =“”/>的PHP?

时间:2015-12-03 13:03:52

标签: php

而不是我使用../

<?php include('../../../header.php'); ?>

有更好的方法吗?例如将<base href>用于HTML

3 个答案:

答案 0 :(得分:1)

您可以尝试以下方法:

$root = $_SERVER['DOCUMENT_ROOT']

include($root.'/projectname/filename.php');

答案 1 :(得分:0)

我使用这种结构:

define('ROOT_PATH', dirname(__DIR__));

#all includes use the constant ROOT_PATH:
require_once ROOT_PATH.'/controllers/controllers.php';

答案 2 :(得分:0)

我设法使用Public Sub Download(URL As String, sDestination As String, Optional sId As String = "Id") colDest.Add sDestination, sId UserControl.AsyncRead URL, vbAsyncTypeFile, sId, vbAsyncReadForceUpdate End Sub Private Sub UserControl_AsyncReadProgress(AsyncProp As AsyncProperty) RaiseEvent Progress(AsyncProp.BytesRead, AsyncProp.BytesMax, AsyncProp.PropertyName) End Sub Private Sub UserControl_AsyncReadComplete(AsyncProp As AsyncProperty) On Error Resume Next If AsyncProp.BytesRead > 0 And AsyncProp.BytesRead = AsyncProp.BytesMax Then Name AsyncProp.value As colDest.Item(AsyncProp.PropertyName) End If colDest.Remove AsyncProp.PropertyName RaiseEvent Completed(AsyncProp.BytesRead, AsyncProp.BytesMax, AsyncProp.PropertyName) End Sub