2012-02-20 60 views
0

比方說,我有這個功能,但我不知道該怎麼稱呼它......如何使用這個php函數?

echo getYoutubeSearchVideosFeeds($variables); 

與我應該替換$哪些變量調用$ Q,$排序依據,$ startIndex和等等?

function getYoutubeSearchVideosFeeds($criteria) { 
    $url = 'http://gdata.youtube.com/feeds/api/videos?'; 
    $q = urlencode($criteria['q']); 
    $orderby = $criteria['orderby']; // relevance, published, viewCount, rating 
    $startIndex = $criteria['start-index']; 
    $maxResults = $criteria['max-results']; 
    $author = $criteria['author']; 
    $format = $criteria['format']; 
    $lr = $criteria['lr']; // fr, en 
    $safeSearch = $criteria['safeSearch']; //none, moderate, strict 

    // more code 
} 
+2

這個函數來自哪裏? – 2012-02-20 00:47:16

回答

0

只要通過將其與在函數中列出的值關聯數組:

getYoutubeSearchVideosFeeds(array('q' => '...', 'orderby' => '...', ...)); 
0

傳遞填充有用於每個鍵的值的數組的函數需要:

getYoutubeSearchVideosFeeds(array('q' => '...', 'orderby' => '...')); 
0
getYoutubeSearchVideosFeeds(

array(

"q"=>"CriteriaValuesHere..GetItFromGDataHelp", 
"start-index" => "Other Values" 
. 
. 
.   
) 


);