Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我从 cli 获得输入时,我 var_dump 它,这向我展示了:
string(2) "Y "
所以我如何理解我收到了单个字符和一袋空格,所以这段代码将返回 false ($input == "Y")。我该如何解决这个问题?
($input == "Y")
您可以使用轻松删除所有这些空格trim()
trim()
(trim($input) == 'Y')