Home > Backend Development > PHP Tutorial > php使用路径的时候,怎么使用绝对路径?

php使用路径的时候,怎么使用绝对路径?

WBOY
Release: 2016-06-06 20:08:09
Original
1609 people have browsed it

比如服务器在'C:AppServwww';

01.php 在 'C:AppServwwwYB-PHPPathDemoChina01.php' ;

就是比如 01.php 加载同目录下的 02.php,
可以写作:

<code>include('./02.php');
include('/02.php');
include('02.php');</code>
Copy after login
Copy after login

但是怎么直接写个在本机绝对路径?
就是这种:

<code>include('http://localhost/YB-PHP/PathDemo/China/02.php');</code>
Copy after login
Copy after login

我试了试但是不行.

回复内容:

比如服务器在'C:AppServwww';

01.php 在 'C:AppServwwwYB-PHPPathDemoChina01.php' ;

就是比如 01.php 加载同目录下的 02.php,
可以写作:

<code>include('./02.php');
include('/02.php');
include('02.php');</code>
Copy after login
Copy after login

但是怎么直接写个在本机绝对路径?
就是这种:

<code>include('http://localhost/YB-PHP/PathDemo/China/02.php');</code>
Copy after login
Copy after login

我试了试但是不行.

绝对路径是指本地路径,不是网络路径。
对你这个文件来说就是:
C:\\AppServ\www\YB-PHP\PathDemo\China\01.php

你这绝对路径别用http啊

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template