管理将我的文件存储在文件夹中,但它们存储时没有文件扩展名.
有没有人知道如何存储文件扩展名的文件?
有点卡在这一个,需要使用多部分表单上传图像和json ..不知道如何发送内容类型标题或上传图像..认为我需要转换为blob ..此刻我只是发送我从文件输入字段获得的数据.
任何建议都会非常感谢
$http({
method: 'POST',
url: URL,
headers: { 'Content-Type': false },
transformRequest: function (data) {
console.log(data);
var formData = new FormData();
formData.append("formatteddata", angular.toJson(data.model));
formData.append('media', Image)
return formData;
},
data: { model: shoutoutData, image: shoutoutImage}
}).
success(function (data, status, headers, config) {
alert("success!");
}).
error(function (data, status, headers, config) {
alert("failed!");
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试将自定义端点添加到最新版本的wp-rest api。我已经有这个了,但是最后带有子弹参数的那个不起作用..有谁知道为什么..如果有人可以帮助,那将会很棒。
register_rest_route( 'wp/v2', '/guestmix', array(
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_guestmixes' )
),
'schema' => array( $this, 'get_public_item_schema' )
) );
register_rest_route( 'wp/v2', '/guestmix/(?P<slug>\d+)', array(
'methods' => 'GET',
'callback' => 'get_guestmix'
) );
Run Code Online (Sandbox Code Playgroud) WooCommerce 的新手,并使用 REST API 获取我已成功完成的产品。
不确定如何使用slug永久链接获取单个产品提供完整的 url,因为我只需要最后的 slug,所以我可以拥有干净的 url,而不是使用id来查找记录。我知道使用 Wordpress rest api 插件,您可以执行此操作posts-api?filter[name]==并按产品 slug 获取帖子,而不是使用:
/wc-api/v3/products/id
Run Code Online (Sandbox Code Playgroud)
我希望能够做到:
/wc-api/v3/products/slug
Run Code Online (Sandbox Code Playgroud)