PHP JSON数组如果等于value然后回显

时间:2017-09-18 05:20:28

标签: php json

我正在尝试从Vimeo API获取每个视频的特定链接。我可以遍历结果并在foreach中回显它们但是当我尝试访问特定值时,它仍然会显示所有结果:

<MemoPads>
    <ReviewFeesType>
        <ReviewFees>
            <ENTRYDATETIME>2017-09-05</ENTRYDATETIME>
            <USERID>admin</USERID>
            <MEMOENTRY>Review fees test</MEMOENTRY>
        </ReviewFees>
    </ReviewFeesType>
    <UnderwriterReviewType>
        <UnderwriterReview>
            <ENTRYDATETIME>2017-04-12</ENTRYDATETIME>
            <USERID>ADMIN</USERID>
            <MEMOENTRY>Underwriter Rule</MEMOENTRY>
        </UnderwriterReview>
        <UnderwriterReview>
            <ENTRYDATETIME>2017-09-05</ENTRYDATETIME>
            <USERID>admin</USERID>
            <MEMOENTRY>month bank statement. </MEMOENTRY>
        </UnderwriterReview>
    </UnderwriterReviewType>
</MemoPads>

如何只获取$ value等于'1920'的结果?

1 个答案:

答案 0 :(得分:2)

使用==代替= here。

 if ($value['width'] == 1920) {

        echo $value['link_secure'];

    } else {

        echo 'no match';

    }