trackback_response

函式
trackback_response ( $error = 0, $error_message = '' )
引數
  • (int|bool) $error Whether there was an error. Default '0'. Accepts '0' or '1', true or false.
    Required:
  • (string) $error_message Error message if an error occurred. Default empty string.
    Required:
    Default: (empty)
定義位置
相關方法
trackback_urltrackback_rdftrackbacktrackback_url_listdo_trackbacks
引入
0.71
棄用
-

trackback_response: 這個函式為trackback ping請求生成一個XML響應。響應包括被ping的文章的標題和摘錄。

迴應一個回帖。

用一個錯誤或成功的XML資訊來回應。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function trackback_response( $error = 0, $error_message = '' ) {
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );
if ( $error ) {
echo '<?xml version="1.0" encoding="utf-8"?' . ">n";
echo "<response>n";
echo "<error>1</error>n";
echo "<message>$error_message</message>n";
echo '</response>';
die();
} else {
echo '<?xml version="1.0" encoding="utf-8"?' . ">n";
echo "<response>n";
echo "<error>0</error>n";
echo '</response>';
}
}
function trackback_response( $error = 0, $error_message = '' ) { header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) ); if ( $error ) { echo '<?xml version="1.0" encoding="utf-8"?' . ">n"; echo "<response>n"; echo "<error>1</error>n"; echo "<message>$error_message</message>n"; echo '</response>'; die(); } else { echo '<?xml version="1.0" encoding="utf-8"?' . ">n"; echo "<response>n"; echo "<error>0</error>n"; echo '</response>'; } }
function trackback_response( $error = 0, $error_message = '' ) {
	header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );

	if ( $error ) {
		echo '<?xml version="1.0" encoding="utf-8"?' . ">n";
		echo "<response>n";
		echo "<error>1</error>n";
		echo "<message>$error_message</message>n";
		echo '</response>';
		die();
	} else {
		echo '<?xml version="1.0" encoding="utf-8"?' . ">n";
		echo "<response>n";
		echo "<error>0</error>n";
		echo '</response>';
	}
}

常見問題

FAQs
檢視更多 >