php substr(string_name, start_position, string_length_to_cut)

php substr(string_name, start_position, string_length_to_cut)

substr(string_name, start_position, string_length_to_cut) 中,如果我给 string_length_to_cut 大于 string_name 会发生什么,为什么?

文档 here 中概述了您问题的答案。示例 #3.

echo substr('abcdef', 0, 8);  // abcdef

多余的长度直接用空白代替space。