如何使用PHP [重复]在Json url中获取数据(How to get data in Json url using PHP [duplicate])
这个问题在这里已有答案:
所以我有一个输出如下的URL:
{ "kind": "youtube#channelListResponse", "etag": "\"IHLB7Mi__JPvvG2zLQWAg8l36UU/cElfTza4UGHG8g6mYtCKSIOXxq0\"", "pageInfo": { "totalResults": 1, "resultsPerPage": 5 }, "items": [ { "kind": "youtube#channel", "etag": "\"IHLB7Mi__JPvvG2zLQWAg8l36UU/EGw-f95GMJ7EnCAhVPMzL1JSykQ\"", "id": "UCxAICW_LdkfFYwTqTHHE0vg", "statistics": { "viewCount": "107418936", "commentCount": "295", "subscriberCount": "428265", "hiddenSubscriberCount": false, "videoCount": "2270" } } ] }
我用这个函数得到了
kind
function test() { $url = "https://www.googleapis.com/youtube/v3/channels?part=statistics&forUsername=youtube&key={key}"; $json = file_get_contents($url); $json_data = json_decode($json, true); echo $json_data["kind"]; }
但我的问题是我需要获取其他数据,包括
viewCount
但我找不到它的功能..原谅我,我刚刚开始学习Json,因为我不得不弃用YouTube API v 2而且我不得不切换到依赖于Json的v 3.0。
非常感谢您协助初学者!
This question already has an answer here:
So I have a URL that outputs as follows:
{ "kind": "youtube#channelListResponse", "etag": "\"IHLB7Mi__JPvvG2zLQWAg8l36UU/cElfTza4UGHG8g6mYtCKSIOXxq0\"", "pageInfo": { "totalResults": 1, "resultsPerPage": 5 }, "items": [ { "kind": "youtube#channel", "etag": "\"IHLB7Mi__JPvvG2zLQWAg8l36UU/EGw-f95GMJ7EnCAhVPMzL1JSykQ\"", "id": "UCxAICW_LdkfFYwTqTHHE0vg", "statistics": { "viewCount": "107418936", "commentCount": "295", "subscriberCount": "428265", "hiddenSubscriberCount": false, "videoCount": "2270" } } ] }
I use this function to get the
kind
function test() { $url = "https://www.googleapis.com/youtube/v3/channels?part=statistics&forUsername=youtube&key={key}"; $json = file_get_contents($url); $json_data = json_decode($json, true); echo $json_data["kind"]; }
But my issue is that I need to get other data including
viewCount
but I can't find a function for it..Forgive me, I just started learning Json because i had to since YouTube API v 2 was deprecated and I had to switch to v 3.0 which relies on Json..
Thank you so much for assisting a beginner !
原文:
最满意答案
安装32位可再发行组件就足够了。
It is enough to install the 32bit redistributable.
相关问答
更多-
处理器,操作系统:32位,64位(Processor, OS : 32bit, 64 bit)[2022-03-23]
这一切都归结为电线。 在数字电路中,只有0和1(通常是低电压和高电压)可以从一个元件(CPU)传输到另一个元件(存储器芯片)。 如果我只有1根电线,则每个时钟周期只能在电线上发送1或0。 这意味着我只能寻址2个字节(假设字节寻址,并且整个地址仅在1个周期内以速度传输!)。 如果我有2条线,我可以处理4个字节。 因为我可以通过两条线发送:(0,0),(0,1),(1,0)或(1,1)。 所以基本上这是2线的力量。 所以如果我有32根电线,我可以解决4 GB的问题,如果我有64根电线,我可以解决更多问题。 工程 ... -
要调用的函数是IsWow64Process 。 它会告诉您的32位应用程序它是否在64位Windows上运行。 如果程序编译为64位,它已经知道了。 The function to call is IsWow64Process or IsWow64Process2. It tells your 32-bit application if it is running on a 64 bit Windows. If the program is compiled for 64 bits, it will alr ...
-
编译时,所有标准库的使用都会创建必须在链接时解析的引用。 链接器在导入库中烘焙匹配的运行时DLL,这些DLL必须在加载时完全匹配。 这意味着匹配编译器版本,Service Pack和位数。 另请记住,32位进程无法加载64位DLL。 由于64位redist仅包含64位DLL,因此加载32位可执行文件时没有任何帮助。 When you compile, all use of the standard library creates references that must be resolved at lin ...
-
由32位JDK生成的字节代码与由64位JDK生成的字节代码相同。 如果您的问题只发生在64位JVM上,是因为JVM中存在一个错误,并且使用64位JDK不会产生任何影响。 The byte code generated by a 32-bit JDK is identical to the byte code generated by a 64-bit JDK. If you have a problem which only occurs on a 64-bit JVM, is because there ...
-
期望具有单个大块内存并使用原始指针的32位JVM不能使用超过4 Gb(因为这也是适用于指针的32位限制)。 这包括Sun和 - 我很确定 - 也是IBM的实现。 我不知道如果JRockit或其他人有32位实现的大内存选项。 如果您希望达到此限制,则应强烈考虑启动并行跟踪,为生产环境验证64位JVM,以便在32位环境出现故障时准备就绪。 否则你将不得不在压力下做这些工作,这是永远不好的。 编辑2014-05-15:Oracle常见问题 32位JVM的理论堆最大限制为4G。 由于可用的交换,内核地址空间使用,内 ...
-
一个主要原因是32位操作系统无法寻址4GB的RAM。 在涉及虚拟机的许多开发环境中,4-8GB可能至关重要,甚至在一般情况下甚至是繁重的工作。 这就是为什么我总是坚持使用64位,并且所有现代CPU都支持它。 One major reason is the fact that 32-bit OSs can't address 4GB of RAM. 4-8GB can be crucial in a lot of development environments where virtual machines ...
-
使用可以模拟64位处理器的QEMU之类的东西。 Use something like QEMU that can emulate a 64-bit processor.
-
确保使用32位WScript来测试VB脚本。 双击它将使用64位 - 这将有助于诊断您的问题。 Make sure you use the 32-bit WScript to test your VB Script as well. Double-clicking it will use 64-bit - that will help go to diagnosing your issue.
-
在64位操作系统上的32位应用程序池中运行我的网站(Running my web site in a 32-bit application pool on a 64-bit OS)[2022-12-06]
可悲的是,我不认为在这里有人能够想出这个办法。 我使用的两个DLL来自一个下载的ZIP文件,当我去了那些文件的属性时,有一个盒子说,他们已经从互联网上下载,我不得不“解锁”它们。 似乎64位应用程序池没有尊重这一点,但是当我降到32位时它确实如此。 一旦我“解锁”DLL,一切都开始正常工作。 Sadly, I don't think there is any way someone here could have figured this out. Two DLLs I was using came fro ... -
安装32位可再发行组件就足够了。 It is enough to install the 32bit redistributable.