Laravel RSS 源 img 未验证

Laravel RSS Feed img not validated

大家好,我需要你们的帮助,

我有这个 rss 提要视图,当我试图在 http://www.feedvalidator.org/check.cgi?url=http%3A%2F%2Fwizardform.yourmartialarts.school%2Fnextgrading 上验证它时,我收到了这个错误。

line 6, column 8: Undefined channel element: img [help]

line 20, column 7: XML parsing error: :20:7: mismatched tag [help]

<img src="{{ utf8_decode(url('/getNextGrading') . '/' . $user->id) }}" style="width: 500px;" alt="image"/>

这是代码

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"> 
<channel>
<title>Next Grading</title> 
@if($users->count() > 0)
    @foreach($users as $user) 
        <img src="{{ utf8_decode(url('/getNextGrading') . '/' . $user->id) }}" style="width: 500px;" alt="image"/>     
        <item>         
        <title>Next Grading</title> 
        <description>
        {{-- {{$user->name . ' ' .$user->organization_id . ' ' . $user->id}} <hr> --}}
        </description>
        <guid isPermaLink="false"></guid> 
        <media:content url="{{ url('/getNextGrading') . '/' . $user->id }}" fileSize="2471632" type="picture/jpg" height="240" width="320" duration="147" medium="video" isDefault="true"> 
        <media:thumbnail url="http://www.webmonkey.com/images/monkeyrock-thumb.jpg" height="98" width="145"></media:thumbnail>
        </media:content> 
        <media:content duration="180" medium="video" isDefault="true">
        <media:player url="http://www.somevideouploadsite/webmonkey.html"></media:player> 
        <media:thumbnail url="http://www.webmonkey.com/images/both-thumb.jpg" height="98" width="145"></media:thumbnail> 
        </media:content> 
        </item>         
    @endforeach
@else
    <item> 
        <title>No Birthdays</title> 
        <!-- <guid isPermaLink="false"></guid>  -->
        <media:content url="{{ asset('assets/images/bdays/nobday.jpg') }}" fileSize="2471632" type="picture/jpg" height="240" width="320" duration="147" medium="video" isDefault="true">  
        <media:thumbnail url="http://www.webmonkey.com/images/monkeyrock-thumb.jpg" height="98" width="145"></media:thumbnail>
        </media:content> 
        <media:content duration="180" medium="video" isDefault="true">
        <media:player url="http://www.somevideouploadsite/webmonkey.html"></media:player> 
        <media:thumbnail url="http://www.webmonkey.com/images/both-thumb.jpg" height="98" width="145"></media:thumbnail> 
        </media:content> 
    </item> 
@endif
 </channel> 
 </rss>

RSS 2.0 为 <channel> 而不是 <img> 定义了 <image> sub-element。

<url><title><link> sub-element 是必需的,而 <width> 和 sub-element 是可选的。

<image>
  <url>{{ utf8_decode(url('/getNextGrading') . '/' . $user->id) }}</url>
  <title>Next Grading</title>
  <link>{{ utf8_decode(url('/getNextGrading') . '/' . $user->id) }}</link>
  <width>144</width> <!--Maximum value is 144-->
</image>

参考

http://www.feedvalidator.org/docs/rss2.html