接触PHP不久,对于/和\的用法感到疑惑比如关于文件目录的时候../和./的区别是什么?
//和\\的区别又是什么
能不能给解释下,谢谢。请尽量回答的详细一点

解决方案 »

  1.   

    接着忽悠:路径中的/
    ./ 表示当前目录
    ../ 表示上一层目录
    例如
    d:/a/b/./d.txt  表示的路径相当与d:/a/b/d.txt
    d:/a/b/../d.txt 表示的路径相当与d:/a/d.txthttp://topic.csdn.net/u/20120219/11/./a45c507f-c424-4d01-9239-f1ca8347777a.html
    相当于
    http://topic.csdn.net/u/20120219/11/a45c507f-c424-4d01-9239-f1ca8347777a.htmlhttp://topic.csdn.net/u/20120219/11/222/../a45c507f-c424-4d01-9239-f1ca8347777a.html
    相当于
    http://topic.csdn.net/u/20120219/11/a45c507f-c424-4d01-9239-f1ca8347777a.html路径中的\
    通常windows的路径表示用\分隔,也可以用/。而linux用/
    C:\Documents and Settings\Administrator\My Documents\Tencent Files
    /root/software/coreutils/
    表达式运算符中的/
    $a / $b 除法 $a 除以 $b 的商。
    字符串中的\\
    \在字符串中是有特殊用途的,有时候可能需要使用\本身。就需要用\\来表示\<?php
    echo 'this is a simple string';// 可以录入多行
    echo 'You can also have embedded newlines in 
    strings this way as it is
    okay to do';// 输出: Arnold once said: "I'll be back"
    echo 'Arnold once said: "I\'ll be back"';// 输出: You deleted C:\*.*?
    echo 'You deleted C:\\*.*?';// 输出: You deleted C:\*.*?
    echo 'You deleted C:\*.*?';// 输出: This will not expand: \n a newline
    echo 'This will not expand: \n a newline';// 输出: Variables do not $expand $either
    echo 'Variables do not $expand $either';
    ?>
    注释//注释PHP 支持 C,C++ 和 Unix Shell 风格(Perl 风格)的注释。例如:<?php
        echo "This is a test"; // This is a one-line c++ style comment
        /* This is a multi line comment
           yet another line of comment */
        echo "This is yet another test";
        echo 'One Final Test'; # This is a one-line shell-style comment
    ?>
    单行注释仅仅注释到行末或者当前的 PHP 代码块,视乎哪个首先出现。这意味着在 // ... ?> 或者 # ... ?> 之后的 HTML 代码将被显示出来:?> 跳出了 PHP 模式并返回了 HTML 模式,// 或 # 并不能影响到这一点。如果启用了 asp_tags 配置选项,其行为和 // %> 或 # %> 相同。不过,</script> 标记在单行注释中不会跳出 PHP 模式。<h1>This is an <?php # echo "simple";?> example.</h1>
    <p>The header above will say 'This is an example'.
    C 风格的注释在碰到第一个 */ 时结束。要确保不要嵌套 C 风格的注释。试图注释掉一大块代码时很容易出现该错误。<?php
     /*
        echo "This is a test"; /* This comment will cause a problem */
     */
    ?>