我正在使用React superagent将对象POST到Php文件,因此我可以在Mysql数据库中插入数据。我无法弄清楚Php将如何接收这个物体。
React superagent:
public static class myThread extends Thread{
int x;
public myThread(int x){
this.x = x;
}
private static final int MAX_AVAILABLE = 1;
private final Semaphore available = new Semaphore(MAX_AVAILABLE, true);
public void run(){
try{
available.acquire();
//Critical Section
}
catch(Exception e){
System.out.println("Error");
}
finally{
available.release();
}
}
}
Php post.php
submitData () {
Request.post('url')
.set('Content-Type', 'application/json')
.send('{"first_name":"John", "last_mane":"Doe"}')
.end()
}