Heim  >  Artikel  >  Backend-Entwicklung  >  关于在dos 下 command php 跟 在web的环境下 斜线跟反斜杠的问题

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

WBOY
WBOYOriginal
2016-06-06 20:37:421036Durchsuche

标题所说为同一支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下

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn