Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何归还单一资产OhMyBrew Laravel Shopify_Php_Laravel_Shopify_Shopify Api - Fatal编程技术网

Php 如何归还单一资产OhMyBrew Laravel Shopify

Php 如何归还单一资产OhMyBrew Laravel Shopify,php,laravel,shopify,shopify-api,Php,Laravel,Shopify,Shopify Api,我正在尝试使用ohmybrew/Laravel Shopify在Laravel中以单个Shopify资产的形式获取一个对象,该行为: $asset = $shop->api()->rest('GET', '/admin/api/'.ShopifyApp::api()->getVersion().'/themes/80166092888/assets.json?asset[key]=snippets/collection-grid-item.liquid'); 我相信$asse

我正在尝试使用ohmybrew/Laravel Shopify在Laravel中以单个Shopify资产的形式获取一个对象,该行为:

$asset = $shop->api()->rest('GET', '/admin/api/'.ShopifyApp::api()->getVersion().'/themes/80166092888/assets.json?asset[key]=snippets/collection-grid-item.liquid');
我相信$asset的结果应该是Shopify资产,但当我打印$asset时,我得到以下结果:

stdClass对象[errors]=>[response]=>GuzzleHttp\Psr7\response:private]=>OK[statusCode:GuzzleHttp\Psr7\response:private]=>200[headers:GuzzleHttp\Psr7\response:private]=>Array[Date]=>Array[0]=>2019年12月16日星期一13:28:09 GMT[内容类型]=>Array[0]=>text/html;字符集=utf-8[传输编码]=>数组[0]=>分块的[连接]=>数组[0]=>保持活动状态[设置Cookie]=>数组[0]=>\uuuu cfduid=db02a99a7bcc26406fd2df1c93df79a7e1576502889;expires=周三,20年1月15日13:28:09 GMT;路径=/;域名=.myshopify.com;HttpOnly[1]=>_secure_admin_session_id=7e198a5093ed7d91cfd87bda81a73126;path=/admin;expires=星期一,2020年3月16日13:28:09-0000;保护HttpOnly[2]=>安全管理会话id csrf=7e198a5093ed7d91cfd87bda81a73126;path=/admin;expires=星期一,2020年3月16日13:28:09-0000;保护HttpOnly;SameSite=Lax[3]=>_orig_referer=;Expires=周一,19年12月30日13:28:09 GMT;路径=/;HttpOnly[4]=>\u登录\u页面=%2Fadmin%2Fauth%2login;Expires=周一,19年12月30日13:28:09 GMT;路径=/;HttpOnly[5]=>主数据=EYJFCMFPBHMIONSIBWZC2FNZSIKJBAEPJAWSZTTJGBVL6VMLAAT0TLROA0XUUMTOEMN0RZNU55MWXZV0L6WVRNM05HVMTOBVLHT2DARJNPT0ILCJLEIYYMDIXLTE2VDEZI4OJJA5OW0OYOYIJJJB29RAWUX21HC3RLCL91ZHIIFX0%3D-E71A00ABD0AD0401D5AF67647E6CE78;域名=.myshopify.com;path=/admin;expires=Thu,2021年12月16日13:28:09-0000;保护HttpOnly[X-Sorting-Hat-PodId]=>Array[0]=>87[X-Sorting-Hat-ShopId]=>Array[0]=>8865972324[Vary]=>Array[0]=>Accept Encoding[referer Policy]=>Array[0]=>origin when cross-origin[X-Frame-Options]=>Array[0]=>DENY[X-ShopId]=>Array[0]=>8865972324[X-ShardId]=>Array[0]=>=>无缓存,无存储[X-Shopify-Login-Required]=>数组[0]=>真[Shopify验证机制]=>数组[0]=>密码[严格传输安全]=>数组[0]=>最大年龄=7889238[X-Shopify-Stage]=>数组[0]=>生产[内容安全策略]=>数组[0]=>默认src“self”数据:blob:“不安全内联”“不安全评估”https://*shopify pos://;阻止所有混合内容;儿童src“self”https://shopify pos://;连接src“self”wss://https://*;“无”;img src“self”数据:blob:https:;脚本src'unsafe inline''unsafe eval';升级不安全的请求;报告uri/csp报告?来源%5Baction%5D=登录和来源%5Bapp%5D=Shopify和来源%5Bcontroller%5D=管理员%2Auth和来源%5Bsection%5D=管理员和来源%5Buuid%5D=8F3C44C-7e32-48f5-a018-80df31681bc9[X-Content-Type-Options]=>Array[0]=>nosniff[X-Download-Options]=>Array[0]=>noopen[X-Allowed-Cross-Domain-Policys]=>Array[0]=>[X-XSS-Protection]=>Array[0]=>1;mode=block;report=/XSS report?source%5Baction%5D=login&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Auth&source%5Buid%5D=8f3c44cc-7e32-48f5-a018-80df31681bc9[X-Dc]=>Array[0]=>gcp-us-east1、gcp-us-central1、gcp-us-central1、gcp-us-central1、gcp-us-central1[L1]=>Array[0]=>{报告对象:网络错误,最大年龄:2592000,失败分数:0.01,成功分数:0.0001}[1]=>{报告对象:网络错误,最大年龄:2592000,失败分数:0.01,成功分数:0.0001}[报告对象==>数组[0]=>{组:网络错误,最大年龄:2592000,端点:[{url:}}[1]=>{组:网络错误,最大年龄:2592000,端点:[url:}][X-Request-ID]=>阵列[0]=>8f3c44cc-7e32-48f5-a018-80df31681bc9[CF缓存状态]=>阵列[0]=>动态[Expect CT]=>阵列[0]=>max age=604800,报告uri=https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct [服务器]=>阵列[0]=>cloudflare[CF-RAY]=>阵列[0]=>5460ffb34d00dc0b LHR[headerNames:GuzzleHttp\Psr7\Response:private]=>Array[date]=>date[content type]=>content type[transfer encoding]=>transfer encoding[connection]=>connection[set cookie]=>set cookie[x-sorting-hat-podid]=>x-sorting-hat-shopid][vary]=>x-sorting-hat-shopid[vary]=>vary[referer policy]=>referer策略[x-frame-options]=>x-frame-options[x-shopid]=>x-shopid[x-shardid]=>x-shardid[cache control]=>cache control[x-shopify-login-required]=>x-shopify-login-required[shopify验证机制]=>shopify验证机制[严格传输安全]=>x-shopify-stage[内容安全策略]=>内容安全策略[x-Content-type-options]=>x-Content-type-options[x-download-options]=>x-download-options[x-Allowed-cross-domain-Policys]=>x-Allowed-cross-domain-Policys[x-xss-protection]=>x-xss-protection[x-dc]=>x-dc[nel]=>nel[报告对象]=>报告对象[x-request-id]=>x-request-id[cf -缓存状态]=>CF缓存状态[expect ct]=>expect ct[server]=>server[CF-ray]=>CF-ray[protocol:GuzzleHttp\Psr7\Response:private]=>1.1[stream:GuzzleHttp\Psr7\Response:private]=>GuzzleHttp\Psr7\stream对象[stream:GuzzleHttp\Psr7\stream:private]=>[seekable:GuzzleHttp\Psr7\Stream:private]=>1[readable:GuzzleHttp\Psr7\Stream:private]=>1[writeable:GuzzleHttp\Psr7\Stream:private]=>1[uri:GuzzleHttp\Psr7\Stream:private]=>php://temp [customMetadata:GuzzleHttp\Psr7\Stream:private]=>Array[body]=>[link]=>[Timestaps]=>Array[0]=>[1]=>1576502889.2041

我可以使用以下方法正确检索所有资产的列表:

$assets = $shop->api()->rest('GET', '/admin/api/'.ShopifyApp::api()->getVersion().'/themes/80166092888/assets.json');
但是这个对象不包括我需要的信息,特别是每项资产的价值

Shopify文档详细说明了这是检索单个资产的正确方法:

GET/admin/api/2019-10/themes/{theme\u id}/assets.json?asset[key]=templates/index.liquid&theme\u id=828155753

我可以成功地从浏览器发出GET请求,以检索我想要的信息


不确定我在PHP/Laravel/OhMyBrew方面做错了什么。

我在OhMyBrew/Basic Shopify API的文档中找到了答案,它是Laravel Shopify包中实现的API包装。url参数需要作为单独的参数传递给rest方法,如下所示:

$assets = $shop->api()->rest('GET', '/admin/api/'.ShopifyApp::api()->getVersion().'/themes/80166092888/assets.json', ['asset[key]' => 'snippets/collection-grid-item.liquid']);

希望这能帮助其他人解决同样的问题。

我在ohmybrew/Basic Shopify API的文档中找到了答案,它是在laravel Shopify包中实现的API包装。url参数需要作为单独的参数传递给rest方法,如下所示:

$assets = $shop->api()->rest('GET', '/admin/api/'.ShopifyApp::api()->getVersion().'/themes/80166092888/assets.json', ['asset[key]' => 'snippets/collection-grid-item.liquid']);
希望这能帮助其他与同样问题作斗争的人