①后来想到,有可能是HTML转义问题,于是就将"yyyy年MM月dd日 E "中的空格全部去掉了,结果可以正常取值了或者改为“yyyy年MM月dd日-E” ②还有一种方法,只要使用转义字符将准备显示的字符串中内容逐个替换即可
复制代码
代码如下:
<% String result = ""; for (int i = 0; i < date.length(); i++) { switch (date.charAt(i)) { case '<': result += "<"; break; case '>': result += ">"; break; case '&': result += "&"; break; case '"': result += "\""; break; case '\'': result += "'"; break; case ' ': result += " "; break; default: result += date.charAt(i); } } %>
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn