更新代码
try{
function processLink( $link , $appendArr ){
## gets url from database as outlined above.
$xmlUrl = $link;
#Loads the url above into XML
$ConvertToXml = simplexml_load_file($xmlUrl);
# -> Setup XML
$appendArr[] = $ConvertToXml->channel->item;
}
#Connect to DB
require_once '../../src/conn/dbc.php';
$dbconn = new PDO('mysql:host=localhost;port=3306;dbname=thedb',$db_user,$db_pass,array(PDO::ATTR_PERSISTENT => true));
$q = $dbconn->prepare("SELECT FW_ArtSrcLink FROM FW_ArtSrc WHERE OneSet=:OneSet and leagID = :TheLeagueID");
$q->execute(array(':OneSet' => 1, ':TheLeagueID' => 14)); # SET LEAGUE HERE.
$result = $q->fetchAll();
$newsStory = array();
$title = $newsStory->title;
$link = $newsStory->link;
foreach ($result as $value ){
if ( is_array($value) ){
foreach ( $value as $secondValue ){
processLink($secondValue , &$newsStory);
}
continue;
}
processLink($value , $newsStory);
}
//print_r($newsStory);
echo 'TITLE: '.$title;
echo 'LINK'.$link;
}
如何修改我的代码以仅获取[title]
and [link]
?- 这意味着它不输出任何东西::
它当前输出: