简体   繁体   中英

Passing a big string data from JavaScript to php

I have a very long string variable(2000+ characters) in JavaScript and I need to pass it to a Php page so that I can store it in a Database. Which would be The BEST technique to pass this string variable along with some other data from JavaScript to a Php page ?

If you are using Ajax, try posting the data. The encoding is automatic and there is no size limit.

$.post('/my/url.php', { 'big': 'aoeuaoeuaoeuaoeuaoeu' } );

Of course the contents of the big variable will be much bigger. 2000 characters isn't that much. I've posted at least that much with no problem.

我不太了解,但我建议您使用json_encode()可以做到。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM