简体   繁体   中英

PHP scandir in windows server

I'm working on a windows server and I want to use scandir in folder "temp_orders". I echo the full path and I got

       "C:\Domains\oaxiscom\oaxis.com\wwwroot\groupon_redeem" 

its using backwardslash instead of forward and I cannot read the contents inside temp_orders if I scandir

       "C:\Domains\oaxiscom\oaxis.com\wwwroot\groupon_redeem\temp_orders" 

- this creates syntax error coz of "\\". any help?

尝试使用\\\\代替\\ ,然后看看它如何进行。

Practically every time where I have needed a path in Windows programming, I was able to use either the forward slash ( / ) or the backwards slash ( \\ ) between path folder/file names.

Since the backwards slash is used as an escape sequence starting character in so many programming languages, using the forward slash in path names is pretty standard with me these days.

So you could try using forwards slash ( / ) instead of backwards slash.

Since a backwards slash is interpreted by php as an escape, if you use two backwards slashes ( \\\\ ), normally the two are replaced by a single backwards slash when the string is processed by the interpreter.

The backwards slash is also used to insert a quote into a quoted string ( \\' or \\" ) along with some other special characters such as new line character ( \\n ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM