Laravel PHP 从特定列获取值

<?php


$file = 'https://demo.conitor.in/Remembered/views/feed.php';


if(!$xml = simplexml_load_file($file)){

    // Will return false if the file doesn't contain a well formated XML document.

    echo "file not found!";

} else {

    echo "<table><thead><tr><th>Number</th><th>Title</th><th>First Name</th><th>State</th></tr></thead><tbody>";

    $i = 0;


    // Refere your SimpleXmlObject Struture for more information.

    foreach ($xml->channel->item as $item) {



       echo "<tr><td>" .++$i ."</td><td>" . $item->title . "</td><td>" . $item->DeceasedFirstName . "</td><td>" . $item->State ."</td></tr>";



    }



    echo "</tbody></table>";

}

?>


千万里不及你
浏览 119回答 2
2回答

慕妹3242003

尝试使用 pluck 方法而不是 selectwhere(...)->pluck('column2');

沧海一幻觉

你可以做Model::where('column_3',&nbsp;1)->pluck('column_2')->toArray();该方法toArray()会将其转换collection为数组
打开App,查看更多内容
随时随地看视频慕课网APP