小编hoy*_*kot的帖子

是否有任何良好的通用JPA DAO实现?

根据这篇文章,通用JPA DAO(数据访问对象)是一个非常好的模式.

有没有好的实施?

java dao jpa

6
推荐指数
1
解决办法
2万
查看次数

使用PHP将特殊字符转换为相应的HTML代码的最佳方法是什么?

我想转换所有内容,如空格,单/双引号,换行符等.

这是一个示例输入(Thanks som_nangia):

Escape Check < &quot;escape these&quot; > <“and these”> <html><tr><td></td></tr></html> 'these will need escaping too' ‘ so will these’ <script>&nbsp;</script>
Run Code Online (Sandbox Code Playgroud)

以下是我正在考虑的选项:

<pre>Escape Check < &quot;escape these&quot; > <“and these”> <html><tr><td></td></tr></html> 'these will need escaping too' ‘ so will these’ <script>&nbsp;</script></pre>

/**
 * Encoding html special characters, including nl2br
 * @param string  $original
 * @return string
 */
function encode_html_sp_chars($original) {
    $table = get_html_translation_table(HTML_ENTITIES);
    $table[' '] = '&nbsp;';
    $encoded = strtr($original, $table);
    return nl2br($encoded);
}
Run Code Online (Sandbox Code Playgroud)

我尝试了htmlspecialchars …

html php

0
推荐指数
1
解决办法
300
查看次数

标签 统计

dao ×1

html ×1

java ×1

jpa ×1

php ×1