关于在dos 下 command php 跟 在web的环境下 斜线跟反斜杠的问题

WBOY
Release: 2016-06-06 20:37:42
Original
1035 people have browsed it

标题所说为同一支php

例如我在一开始 incloud config.php
web
include_once 'config/config.php';

在dos下,就必须改成
include_once 'config\config.php';

重点是老板要求要「同一支可以在web 跑 也能在dos下跑

这支php主要是开启档案用的

请问大大,我在路径上的设定跟 "/","\",要怎么作才能一只在不同的环境下跑呢?

回复内容:

标题所说为同一支php

例如我在一开始 incloud config.php
web
include_once 'config/config.php';

在dos下,就必须改成
include_once 'config\config.php';

重点是老板要求要「同一支可以在web 跑 也能在dos下跑

这支php主要是开启档案用的

请问大大,我在路径上的设定跟 "/","\",要怎么作才能一只在不同的环境下跑呢?

http://stackoverflow.com/questions/6654157/how-to-get-a-platform-independent-directory-separator-in-php

使用 PHP 内置的 DIRECTORY_SEPARATOR 变量作为分隔符。

應該說在cmd下

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!