一句代碼不太明白

來源:互聯網
上載者:User
echo "
檔案上次修改時間".date("Y-m-d H:i:s)",$file_info['mtime']);

echo "
檔案上次修改時間"這一段看的懂
後面加 .date("Y-m-d H:i:s)",串連 為什麼要加這倆雙引號,而且後面引號 為什麼放在括弧外面。 就這不明白


回複討論(解決方案)

寫錯了吧,
echo "
檔案上次修改時間".date("Y-m-d H:i:s",$file_info['mtime']);

date("Y-m-d H:i:s",$file_info['mtime']);
date("Y-m-d H:i:s)",$file_info['mtime']);

多了一個括弧而已,運行下就明白了。

寫錯了,那個括弧不應該有。

寫錯了,那個括弧不應該有。

寫錯了,那個括弧不應該有。

你的代碼:.date("Y-m-d H:i:s )",$file_info['mtime']);
換成:.date("Y-m-d H:i:s",$file_info['mtime']);

你覺得不理解的地方,是最不該不理解的地方
到那裡字串還沒有結束,你就不能斷章取義

字串中可以儲存任何內容,當然也包括 date 的格式串

你把 date("Y-m-d H:i:s",$file_info['mtime'])當成字串
PHP用點 ( . ) 拼接字串的

echo "
檔案上次修改時間" . date("Y-m-d H:i:s",$file_info['mtime']) ;

由一位粗心者,引發的討論

謝謝大家 剛開始學 有很多基礎不明白 結貼啦

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.