Recently because of research cross-domain name, cross-server problem, so bored, think of a cross-server problem of passing objects.
To pass data across servers, use a GET or post submission.
My method here is a bit complicated, but because of the usual work, there is a corresponding class library, so the implementation is relatively simple.
Look at the code first:
Public functionactionsleeptest () {$user= User::model ()find (); //Echo $user->username; Var_dump ($user); $data[' Name ']=Serialize($user); //$data [' name '] = "1315464"; $post=NewPostcurl (); $msg=$post->simulationpost (' HTTP//domain/index.php?r=site/wakeuptest ',$data,TRUE); Echo $msg; //echo $data [' name ']; } Public functionactionwakeuptest () {$user=unserialize($_post[' Name ']); Var_dump($user); }
Should not be difficult to understand, using the YII framework this is very well understood.
PostURL is of course the analog submission post data
This is the perfect place to invoke the user object in Wakeuptest.
Of course there are no cross-domain names, but it is also possible to use the same type of user class created by the YII framework on another server.
Pillbox, you can also serialize the class, directly stored on the server, so that the pillbox day.