0
我想對需要呈現Wordpress頁面/窗口小部件中的數據的站點進行簡單的api調用。在Wordpress頁面和窗口小部件中進行簡單的Rest API調用
我創建了一個新的頁面,並把這個代碼編輯器對話框上我的控制面板:
<?php
$response = wp_remote_get('https://jsonplaceholder.typicode.com/posts/2');
if(is_array($response)) {
$header = $response['headers'];
$body = $response['body'];
}
print($response);
print($header);
print($body);
?>
沒有被呈現在我的WordPress的UI。
是的,我在我的本地環境(使用MAMP)。