저는 php에서 새로 생겼습니다. 최근 변경 사항을 보내는 작은 mediawiki 확장을 작성했습니다. (내 게시 된 데이터를 말릴 수 없습니까?
$wgHooks['RecentChange_save'][] = 'sendto';
function sendto($recentChange){
$serialized_data=serialize($recentChange);
$con=curl_init();
curl_setopt($con, CURLOPT_HEADER, true);
curl_setopt($con,CURLOPT_URL,"http://localhost/test.php");
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($con,CURLOPT_POSTFIELDS,"data={$serialized_data}");
$result=curl_exec($con);
if($result){
return true ;
}
else
return false ;
curl_close($con);
}
와는 다른 코드는 다음과 같습니다 문제는 내가 "1"파일에 쓰기 만하려고이 데이터를 보낼 때입니다 내가 var_dump
을 사용하려고 나타날 것만입니다 있지만 내 보낸 코드가 변경) :
$a = unserialize($_POST['data']);
$d=fopen("log.txt","w");
fwrite($d,print_r($a));//only "1" is written
fclose($d);
내가 바보 같은 질문이라고 생각하지만 도움이 필요하다.
은 캡처print_r
지시 번째 인수 (즉 귀국일) 출력으로
true
를 전달하는 대신 그것을 인쇄하여
fwrite($d,print_r($a, true));
시도는
누군가가 'print_r'의 출력을 삽입하려고 시도했던 곳에서 [더 비슷한 질문이 있습니다] (http://stackoverflow.com/questions/6610870/insert-print-r-output-to-database))'를 데이터베이스에 저장합니다. –