简体   繁体   中英

Sending a JSON string to a php file without using AJAX

This question may be very stupid, but i'm a beginner in web development and I would like to know if there is a way to send JSON string to a php file without using AJAX?

I had a Exam question like this : "Submit the JSON object to the PHP file. In the PHP file you must convert the JSON string into a PHP object."

How this would be possible without AJAX?

Thank you

in html page:

<a href="http://phpfile.php?jsonstring=%7B%22a%22%3A1%7D">send, receive and convert</a>

in phpfile.php:

$json = json_decode($_REQUEST['jsonstring']);
var_dump($json);

result is:

$json = ["a" => 1]

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