【问题标题】:How to identify that the string is a path to any file, using PHPcode?如何使用 PHP 代码识别字符串是任何文件的路径?
【发布时间】:2010-05-14 11:01:25
【问题描述】:

使用PHP,如何识别字符串是任何文件的路径?

【问题讨论】:

    标签: php filepath


    【解决方案1】:

    http://pt.php.net/is_file

    $path = 'string';
    if(is_file($path)){
      // look, it's a file!
    }
    

    【讨论】:

      【解决方案2】:
      is_file($filename)
      is_dir($filename)
      

      如果字符串指向现有文件或目录,将返回true

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-04-15
        • 2018-08-31
        • 1970-01-01
        • 2021-06-08
        • 2018-11-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多