Php 无法使用邮递员从远程计算机访问wordpress rest api以获取JSON响应
我试着在我的mac上安装wordpress。我已成功安装并尝试以json获取响应。它起作用了:就像Php 无法使用邮递员从远程计算机访问wordpress rest api以获取JSON响应,php,wordpress,Php,Wordpress,我试着在我的mac上安装wordpress。我已成功安装并尝试以json获取响应。它起作用了:就像 api : http://localhost:8888/<site>/wp-json/wp/v2/pages api:http://localhost:8888//wp-json/wp/v2/pages i、 站点是wordpress文件夹的名称 答复: [ { "id": 6, "date": "2017-06-04T19:12:37", "date_gmt": "201
api : http://localhost:8888/<site>/wp-json/wp/v2/pages
api:http://localhost:8888//wp-json/wp/v2/pages
i、 站点是wordpress文件夹的名称
答复:
[
{
"id": 6,
"date": "2017-06-04T19:12:37",
"date_gmt": "2017-06-04T19:12:37",
"guid": {
"rendered": "http://localhost:8888/wordpress/?p=6"
},
"modified": "2017-06-04T19:12:37",
"modified_gmt": "2017-06-04T19:12:37",
"slug": "test",
"status": "publish",
"type": "post",
"link": "http://localhost:8888/wordpress/2017/06/04/test/",
"title": {
"rendered": "test"
},
"content": {
"rendered": "<p>Vishal’s new post going viral</p>\n",
"protected": false
},
"excerpt": {
"rendered": "<p>Vishal’s new post going viral</p>\n",
"protected": false
},
"author": 1,
"featured_media": 0,
"comment_status": "open",
"ping_status": "open",
"sticky": false,
"template": "",
"format": "standard",
"meta": [],
"categories": [
1
], .....
[
{
“id”:6,
“日期”:“2017-06-04T19:12:37”,
“日期”:“2017-06-04T19:12:37”,
“guid”:{
“呈现”:http://localhost:8888/wordpress/?p=6"
},
“修改”:“2017-06-04T19:12:37”,
“修改后的gmt”:“2017-06-04T19:12:37”,
“slug”:“test”,
“状态”:“发布”,
“类型”:“职位”,
“链接”:http://localhost:8888/wordpress/2017/06/04/test/",
“标题”:{
“呈现”:“测试”
},
“内容”:{
“呈现”:“Vishal’;的新帖子正在病毒式传播”\n”,
“受保护”:错误
},
“摘录”:{
“呈现”:“Vishal’;的新帖子正在病毒式传播”\n”,
“受保护”:错误
},
"作者":1,,
“特色媒体”:0,
“评论状态”:“打开”,
“ping_状态”:“打开”,
“粘性”:假,
“模板”:“,
“格式”:“标准”,
“元”:[],
“类别”:[
1.
], .....
现在我在linux机器(Centos)的http url上安装了wordpress
如wordpress站点,可通过点击url从远程计算机访问:
http://x.x.x.x/<site>
http://x.x.x.x/
i、 站点是wordpress文件夹的名称
但是当我想打的时候
http://x.x.x.x/<site>/wp-json/wp/v2/pages
http://x.x.x.x//wp-json/wp/v2/pages
然后,我发现:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>404 Not Found</title>
</head>
<body>
<h1>Not Found</h1>
<p>The requested URL /<site>/wp-json/wp/v2/posts was not found on this server.</p>
</body>
404找不到
找不到
在此服务器上找不到请求的URL//wp json/wp/v2/posts
有人能帮我吗?我正在使用最新版本的wordpress安装程序
永久链接设置:
Plain http://x.x.x.x/<site>/?p=123
Day and name http://x.x.x.x/<site>/2017/06/14/sample-post/
Month and name http://x.x.x.x/<site>/2017/06/sample-post/
Numeric http://x.x.x.x/<site>/archives/123
Post name http://x.x.x.x/<site>/sample-post/
Custom Structure
http://x.x.x.x/<site>
/%year%/%monthnum%/%day%/%postname%/
普通http://x.x.x.x//?p=123
日期和姓名http://x.x.x.x//2017/06/14/sample-post/
月份和姓名http://x.x.x.x//2017/06/sample-post/
数字的http://x.x.x.x//archives/123
邮名http://x.x.x.x//sample-post/
自定义结构
http://x.x.x.x/
/%年份%/%monthnum%/%day%/%postname%/
默认我选择了自定义结构你的permalink设置是什么?wp json url不适用于普通/默认permalinkI选择的自定义结构我使用的wordpress文件夹名称是merchant…比如:@RyanAWtry和以下url
http://yourwebsite/?rest_route=/wp/v2/
谢谢@RyanAW它正在工作..我试过url:it以json给出响应。。