【问题标题】:Parse error: syntax error, unexpected T_VARIABLE" for file_exists call [closed]解析错误:语法错误,file_exists 调用的意外 T_VARIABLE” [关闭]
【发布时间】:2012-04-27 14:54:57
【问题描述】:

我正在使用以下代码来确定目录 pdf_Order_pdf/ 中是否存在文件,如果文件不存在,它将显示工作链接或仅显示锚链接,我是 php 的完整新手(如您所见) 但确实了解非常有限。

<?php
if(file_exists('pdf_Order_pdf/'.$row_Recordset1["our_ref"]'.pdf')) 
    echo 'pdf_Order_pdf/'.$row_Recordset1["our_ref"]'.pdf'; 
else 
    echo '#';
?>

上面的代码在以下html之间:

<a href="****code above ****">File</a>

我收到以下错误

Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\SwiftPHP\resultsSupplier.php on line 230

为什么会这样?

【问题讨论】:

    标签: php syntax-error file-exists


    【解决方案1】:

    您忘记了$row_Recordset1["our_ref"] 之后的. 运算符

    if(file_exists('pdf_Order_pdf/'.$row_Recordset1["our_ref"].'.pdf')) 
    ----------------------------------------------------------^
    

    【讨论】:

      【解决方案2】:
      if(file_exists('pdf_Order_pdf/'.$row_Recordset1["our_ref"].'.pdf')) 
                                                                ^dot here
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-02-17
        • 2015-05-11
        • 2013-03-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-02-26
        相关资源
        最近更新 更多