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.
我将值保存到 mysql 中,我看到了类似的空格。
INSERT INTO `names` VALUES (7, 'James Bond ');
我试图做到:
INSERT INTO `names` VALUES (7, 'James Bond');
我知道这样写:(但它也去掉了单词之间的空格)
INSERT INTO `names` VALUES (7, 'JamesBond');
采用trim()
trim()
$variable = trim( $variable );
http://php.net/trim
TRIM()在您的 DBMS 中使用:
TRIM()
INSERT INTO `names` VALUES (7, TRIM('James Bond '));
或者
trim()在 php 中:
$var = trim('James Bond ');