Home > Backend Development > PHP Tutorial > 问一个小菜有关问题

问一个小菜有关问题

WBOY
Release: 2016-06-13 10:46:04
Original
1031 people have browsed it

问一个小菜问题?

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$conn->prepare("INSERT INTO abc(one,two, three) VALUES (:one,:two,:three)");
Copy after login

问一下VALUES (:one,:two,:three)部分每个值如果trim()?(只关注在存入时清除,不想用之前的js清除方式)

------解决方案--------------------
是要清除空格部分?可以用正则替换掉
------解决方案--------------------
$conn->prepare("INSERT INTO abc(one,two, three) VALUES (trim(:one),trim(:two),trim(:three))");

这样可以吗?


------解决方案--------------------
要不就在接受完参数的时候
统一做 trim 和 转义操作 咯
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template