File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes PHP and the fly likes Confusing slashes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "Confusing slashes" Watch "Confusing slashes" New topic
Author

Confusing slashes

egbai mmumene
Ranch Hand

Joined: Sep 18, 2012
Posts: 43
I'm trying to set a directory on a php page but the book i'm using uses the back slash"/" instead of the front slash"\" although both aren't working in displaying my image
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

backslash = \
forward slash = /

Backslash is only used on Windows.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nick Charles
Ranch Hand

Joined: Oct 09, 2011
Posts: 71

I usually use forward slashes (/) in file patchs because backwards slashes (\) are treated as escaped characters in PHP (and Java) strings and thus can lead to surprising results.

Of course, this doesn't solve the problem you are having. To solve that problem, change your file references to use the correct relative path. If you need more help than that, please post the code you are using, and also post the exact location of the file you are attempting to access (full path location for both the PHP file containing the code and the file being referenced, please).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Confusing slashes
 
Similar Threads
WA #1.....word association
problem with html:form
ClassNotFoundException on main class in executable Jar file
accessing a .properties file
file argument to java program on the command line