本文整理汇总了PHP中replaceStr函数的典型用法代码示例。如果您正苦于以下问题:PHP replaceStr函数的具体用法?PHP replaceStr怎么用?PHP replaceStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了replaceStr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
function import()
{
global $db;
if ($_FILES["file"]["error"] > 0) {
echo "Error: " . $_FILES["file"]["error"] . "<br />";
} else {
$file = $_FILES["file"]["tmp_name"];
$tempFile = $_FILES["file"]["name"];
if (!isN($tempFile) && strpos($tempFile, ".csv") !== false && strpos($tempFile, ".csv") === strlen($tempFile) - 4) {
try {
$str = file_get_contents($file);
$str = replaceStr($str, chr(10), "");
$tvArrays = explode(chr(13), $str);
//setGlobalCache("cache_vodlang",$cachearea,1,'php');
} catch (Exception $e) {
$tvArrays = array();
}
foreach ($tvArrays as $tv) {
$items = explode(",", $tv);
if (is_array($items)) {
$count = count($items);
if ($count > 0) {
$id = $items[0];
} else {
$id = '';
$url = '';
}
if ($count > 1) {
$url = $items[1];
} else {
$url = '';
}
if ($count > 2) {
$definition = $items[2];
} else {
$definition = '';
$playfrom = '';
}
if ($count > 3) {
$playfrom = $items[3];
} else {
$playfrom = '';
}
if (!isN($id) && !isN($url)) {
$row = $db->getRow("select * from mac_tv_play where tv_playurl='" . $url . "' and tv_id=" . $id);
if (!$row) {
$sql = "insert into mac_tv_play(tv_id,tv_playurl,status,tv_definition,tv_playfrom) values('" . $id . "','" . $url . "','1','" . $definition . "','" . $playfrom . "')";
} else {
$sql = "update mac_tv_play set status='1', tv_definition='" . $definition . "',tv_playfrom='" . $playfrom . "' where tv_playurl='" . $url . "' and tv_id=" . $id;
}
$row = $db->query($sql);
}
}
}
echo "修改完毕";
} else {
echo "文件格式不对";
}
}
}
示例2: parseMovie
static function parseMovie($id, $p_code)
{
$url = replaceStr(SinaTeachParse::BASE_SHOW_EPISODE, '{COURSE_ID}', $id);
$content = getPage($url, $p_code);
$content = json_decode($content);
if (is_object($content) && property_exists($content, 'result') && property_exists($content->result, 'data') && property_exists($content->result->data, 'lessoninfo')) {
$contents = $content->result->data->lessoninfo;
if (is_array($contents) && count($contents) > 0) {
$sites = array();
$site = array();
$site['site_url'] = "sina";
$site['site_name'] = "sinahd";
$site['max_episode'] = 'true';
$episodes = array();
foreach ($contents as $content) {
$episodes[] = array('name' => property_exists($content, 'name') ? $content->name : "1", 'guest' => property_exists($content, 'short_name') ? $content->short_name : "1", 'episode' => property_exists($content, 'jieci') ? $content->jieci : "1", 'url' => property_exists($content, 'burl') ? $content->burl : "", 'img_url' => property_exists($content, 'thumb') ? $content->thumb : "", 'time' => property_exists($content, 'length') ? $content->length : "", 'stream_url' => property_exists($content, 'stream_url') && !isN($content->stream_url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->stream_url : "", 'androidUrl' => property_exists($content, 'android_url') && !isN($content->android_url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->android_url : "", 'videoAddressUrl' => property_exists($content, 'ipad_url') && !isN($content->ipad_url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->ipad_url : "");
}
$site['episodes'] = $episodes;
$sites[] = $site;
// var_dump($episodes);
return $sites;
}
}
return false;
}
示例3: parseMovieInfoByContent
static function parseMovieInfoByContent($content, $p_code, $type)
{
$content = getBody($content, TVSouLiveParse::contentparmStart, TVSouLiveParse::contentparaend);
// var_dump($content);color='#CC9966'
$content = replaceStr($content, '#CC9966', '#6699CC');
$times = getArray($content, "<font color='#6699CC'>", "</font>");
$names = getArray($content, "<div id='e2' >", "</div>");
// var_dump($names);
// $names=filterScript($names,8191);
$timesArray = explode("{Array}", $times);
$namesArray = explode("{Array}", $names);
// var_dump($timesArray);
$prod_itmes = array();
$index = 0;
foreach ($timesArray as $timeItem) {
$name = $namesArray[$index];
$nameArray = explode('<ahref=', $name);
if (!isN($nameArray[0])) {
$itemName = $nameArray[0];
} else {
$itemName = filterScript($name, 8191);
}
$prod_itmes[$timeItem] = $itemName;
$index++;
}
// var_dump($prod_itmes);
if (count($prod_itmes) == 1) {
return false;
}
return $prod_itmes;
}
示例4: parseMovie
static function parseMovie($id, $p_code, $info)
{
$url = replaceStr(NeteaseTeachParse::BASE_SHOW_EPISODE, '{COURSE_ID}', $id);
$content = getPage($url, $p_code);
$content = json_decode($content);
if (is_object($content)) {
$info->actor = property_exists($content, 'director') ? $content->director : "";
$info->brief = property_exists($content, 'description') ? $content->description : "";
$contents = property_exists($content, 'videoList') ? $content->videoList : array();
if (is_array($contents) && count($contents) > 0) {
$sites = array();
$site = array();
$site['site_url'] = "126";
$site['site_name'] = "126";
$site['max_episode'] = 'true';
$episodes = array();
foreach ($contents as $content) {
$episodes[] = array('name' => property_exists($content, 'title') ? $content->title : "", 'guest' => property_exists($content, 'subtitle') ? $content->subtitle : "", 'episode' => property_exists($content, 'pnumber') ? $content->pnumber : "", 'url' => property_exists($content, 'weburl') ? $content->weburl : "", 'img_url' => property_exists($content, 'imgpath') ? $content->imgpath : "", 'androidUrl' => property_exists($content, 'repovideourl') && !isN($content->repovideourl) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->repovideourl : "", 'videoAddressUrl' => property_exists($content, 'repoMP3url') && !isN($content->repoMP3url) ? MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $content->repoMP3url : "");
}
$site['episodes'] = $episodes;
$sites[] = $site;
// var_dump($episodes);
return $sites;
}
}
return false;
}
示例5: parseIOSVideoUrl
public function parseIOSVideoUrl($url, $p_coding, $p_script)
{
$id = getBody($url, $this->p_videourlstart, $this->p_videourlend);
$id = base64_decode($id);
$url = replaceStr(WLContent::BASE_IOS_URL, "{ID}", $id);
$videoAddressUrl = $videoAddressUrl . MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $url;
return $videoAddressUrl;
}
示例6: cjAPIView
function cjAPIView($info)
{
$strlink = $info->videoUrl;
$p_id = $info->p_id;
$titlecode = $info->title;
$titlecode = filterScript($titlecode, $p_script);
$titlecode = replaceFilters($titlecode, $p_id, 1, 0);
$titlecode = replaceStr(replaceStr(replaceStr($titlecode, ",", " "), "'", ""), "\"\"", "");
$titlecode = trim($titlecode);
$lzcode = $info->curr_episode;
$lzcode = replaceStr($lzcode, "false", "0");
$lzcode = trim($lzcode);
try {
$lzcode = intval($lzcode);
} catch (Exception $e) {
$lzcode = 0;
}
//演员
$starringcode = $info->actor;
$piccode = $info->big_poster;
//图片
$piccode = trim($piccode);
$m_typeid = $info->typeid;
$typecode = !isN($info->type) ? $info->type : "其他";
$typecode = filterScript($typecode, $p_script);
$weburl = $info->sites;
if ($weburl == false) {
return;
} else {
$directedcode = "";
if (!isN($info->director)) {
$directedcode = $info->director;
}
//备注
$remarkscode = "";
if (!isN($info->max_episode)) {
$remarkscode = $info->max_episode;
}
$languagecode = !isN($info->language) ? $info->language : "其他";
$languagecode = trim($languagecode);
$areacode = !isN($info->area) ? $info->area : "其他";
$areacode = trim($areacode);
$contentcode = !isN($info->brief) ? $info->brief : "";
$contentcode = filterScript(replaceFilters($contentcode, $p_id, 2, 0), $p_script);
$contentcode = replaceStr(replaceStr(replaceStr($contentcode, ",", " "), "'", ""), "\"\"", "");
$contentcode = trim($contentcode);
$timecode = !isN($info->pubdate) ? $info->pubdate : "其他";
$duration = !isN($info->duration) ? $info->duration : "";
$m_area = $areacode;
$m_languageid = $languagecode;
foreach ($weburl as $weburlitem) {
$p_playtypebaiduweb = $weburlitem['site_name'];
$baiduwebUrls = $weburlitem['episodes'];
$movieid = updateVod($duration, $baiduwebUrls, $p_id, $titlecode, $piccode, $typecode, $areacode, $strlink, $starringcode, $directedcode, $timecode, $p_playtypebaiduweb, $contentcode, $m_typeid, $lzcode, $languagecode, $remarkscode);
}
}
}
示例7: getAndroidVideoUrl
public function getAndroidVideoUrl($vid)
{
$videoAddressUrl = "";
if (isset($vid) && !is_null($vid)) {
$videoAddressUrl = replaceStr(SinaContent::BASE_URL, "{vid}", $vid);
$videoAddressUrl = MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $videoAddressUrl;
}
return $videoAddressUrl;
}
示例8: parseIOSVideoUrlByContent
public function parseIOSVideoUrlByContent($content, $p_coding, $p_script)
{
$videoUrlParam = getBody($content, $this->p_videocodeApiUrlParamstart, $this->p_videocodeApiUrlParamend);
$videoUrlParam = replaceLine($videoUrlParam);
// var_dump($videoUrlParam);
$p_videoUrlApi = replaceStr($this->p_videocodeApiUrl, "{PROD_ID}", $videoUrlParam);
$videoUrlApiCode = getPageWindow($p_videoUrlApi, $this->p_code);
$videoAddressUrl = getBody($videoUrlApiCode, $this->p_videourlstart, $this->p_videourlend);
return $videoAddressUrl;
}
示例9: parseAndroidVideoUrlByContent
public function parseAndroidVideoUrlByContent($content, $p_coding, $p_script)
{
$aid = getBody($content, '"tvId":"', '",');
if (isN($aid)) {
$aid = getBody($content, 'data-player-tvid="', '"');
}
$api = $url = replaceStr(IqiyiContent::API, "{aid}", $aid);
$json = getPageWindow($api, $p_coding);
// writetofile("iqiyi.log", $json);
return $this->getAndroidVideoUrl(json_decode($json), $p_coding, $p_script);
}
示例10: getAndroidVideoUrl
private function getAndroidVideoUrl($vid)
{
$videoAddressUrl = "";
if (isset($vid) && !is_null($vid)) {
$url = replaceStr(SohuContent::BASE_URL, "{id}", $vid);
$location = getPage($url, "utf-8");
$location = getBody($location, $this->contentparmStart2, $this->contentparaend2);
var_dump($location);
if (!isN($location)) {
$videoAddressUrl = $videoAddressUrl . MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $location;
}
}
return $videoAddressUrl;
}
示例11: parseMovieInfoByContent
static function parseMovieInfoByContent($content, $p_code, $type)
{
$content = getBody($content, CnTVLiveParse::contentparmStart, CnTVLiveParse::contentparaend);
$items = getArray($content, "<dd>", "</dd>");
$itemArray = explode("{Array}", $items);
$prod_itmes = array();
foreach ($itemArray as $item) {
$item = filterScript($item, 8191);
$item = trim($item);
$item = replaceStr($item, '回看', '');
$date = substr($item, 0, 5);
$item = replaceStr($item, $date, '');
$prod_itmes[$date] = $item;
}
if (count($prod_itmes) == 1) {
return false;
}
return $prod_itmes;
}
示例12: save
function save()
{
$keyword = be("all", "keyword");
$program_type = be("all", "program_type");
$keyword = replaceStr($keyword, chr(10), "");
$keywords = explode(chr(13), $keyword);
// var_dump($program_type);
// var_dump($keywords);
global $db;
if (!isN($program_type)) {
$db->query('delete from mac_tv_program_type_item where program_type=\'' . $program_type . '\'');
foreach ($keywords as $keyword) {
if (!isN($keyword)) {
$db->query("insert into mac_tv_program_type_item(program_type,program_name) values('" . $program_type . "','" . $keyword . "')");
}
}
}
echo "修改完毕";
}
示例13: replaceFilters
function replaceFilters($strContent, $pid, $sobject, $f_sys)
{
//$f_sys=0视频, $flag=1文章
global $db;
$sql = "select * from {pre}cj_filters where f_flag=1 and f_sys=" . $f_sys . " and (f_pid=0 or f_pid='" . $pid . "') and (f_object=0 or f_object='" . $sobject . "')";
$rs = $db->query($sql);
if ($rs) {
while ($row = $db->fetch_array($rs)) {
if ($row["f_type"] == 1) {
$strContent = replaceStr($strContent, $row["f_content"], $row["f_rep"]);
} else {
$FilterStr = getBody($strContent, $row["f_strstart"], $row["f_strend"]);
if ($FilterStr != false) {
$strContent = replaceStr($strContent, $row["f_strstart"], "");
$strContent = replaceStr($strContent, $row["f_strend"], "");
$strContent = replaceStr($strContent, $FilterStr, $row["f_rep"]);
}
}
}
}
unset($rs);
return $strContent;
}
示例14: insertChannel
function insertChannel($channels)
{
$keys = array_keys($channels);
global $db;
foreach ($keys as $key) {
$keyArray = explode("{Array}", $key);
$area = $keyArray[0];
$station = $keyArray[1];
$channel = $keyArray[2];
$url = $channels[$key];
$tv_code = replaceStr($url, "http://epg.tvsou.com/program/", "");
$tv_code = replaceStr($tv_code, "/W3.htm", "");
//var_dump($area .'=='.$station.'=='.$channel.'=='.$url.'=='.$tv_code);
$row = $db->getRow('select id from mac_tv where tv_name =\'' . $channel . '\'');
$insertSql = "";
if (!$row) {
$insertSql = "insert into mac_tv(country,area,tv_name,tv_group_name) values('中国','" . $area . "','" . $channel . "','" . $station . "')";
} else {
$insertSql = "update mac_tv set area='" . $area . "', tv_group_name='" . $station . "' where id=" . $row['id'];
}
var_dump($insertSql);
$db->query($insertSql);
}
}
示例15: getAndroidVideoUrl
private function getAndroidVideoUrl($vid)
{
$videoAddressUrl = "";
$videoAddressUrl1 = "";
$videoAddressUrl2 = "";
$videoAddressUrl3 = "";
if (isset($vid) && !is_null($vid)) {
$url = replaceStr(FengXingContent::BASE_URL, "{ID}", $vid);
$mediaid = explode("/", $vid);
$mediaid = $mediaid[0];
// var_dump($mediaid);
$content = getPageWindow($url, "UTF-8");
try {
$json = ContentProviderFactory::obj2arr(json_decode($content));
if (isset($json) && !is_null($json) && isset($json['playinfos']) && !is_null($json['playinfos'])) {
$playinfos = $json['playinfos'];
foreach ($playinfos as $playinfo) {
$cid = $playinfo['cid'];
$t_mediaid = $playinfo['mediaid'];
if ($t_mediaid !== $mediaid) {
continue;
}
$clarity = $playinfo['clarity'];
$byterate = $playinfo['byterate'];
$tempUrl = replaceStr(FengXingContent::BASE_URL_MP3, "{cid}", $cid);
$tempUrl = replaceStr($tempUrl, "{byterate}", $byterate);
$tempjson = ContentProviderFactory::obj2arr(json_decode(getPageWindow($tempUrl, "UTF-8")));
if (isset($tempjson) && !is_null($tempjson) && isset($tempjson['playlist']) && !is_null($tempjson['playlist']) && isset($tempjson['playlist'][0]) && !is_null($tempjson['playlist'][0]) && isset($tempjson['playlist'][0]['urls']) && !is_null($tempjson['playlist'][0]['urls'])) {
$rc = false;
foreach ($tempjson['playlist'][0]['urls'] as $location) {
if ($clarity === "high-dvd") {
if ($rc || !isN($videoAddressUrl3)) {
$videoAddressUrl3 = $videoAddressUrl3 . MovieType::VIDEO_SEP_VERSION;
}
$videoAddressUrl3 = $videoAddressUrl3 . MovieType::TOP_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $location;
$rc = true;
}
if ($clarity === "dvd") {
if ($rc || !isN($videoAddressUrl2)) {
$videoAddressUrl2 = $videoAddressUrl2 . MovieType::VIDEO_SEP_VERSION;
}
$videoAddressUrl2 = $videoAddressUrl2 . MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $location;
$rc = true;
}
if ($clarity === "tv") {
if ($rc || !isN($videoAddressUrl1)) {
$videoAddressUrl1 = $videoAddressUrl1 . MovieType::VIDEO_SEP_VERSION;
}
$videoAddressUrl1 = $videoAddressUrl1 . MovieType::NORMAL . MovieType::VIDEO_NAME_URL_SEP . $location;
$rc = true;
}
}
}
}
}
// var_dump($videoAddressUrl3);
// var_dump($videoAddressUrl1);
// var_dump($videoAddressUrl2);
} catch (Exception $e) {
}
}
$flag = false;
if (!isN($videoAddressUrl3)) {
if ($flag) {
$videoAddressUrl = $videoAddressUrl . MovieType::VIDEO_SEP_VERSION;
}
$videoAddressUrl = $videoAddressUrl . $videoAddressUrl3;
$flag = true;
}
if (!isN($videoAddressUrl2)) {
if ($flag) {
$videoAddressUrl = $videoAddressUrl . MovieType::VIDEO_SEP_VERSION;
}
$videoAddressUrl = $videoAddressUrl . $videoAddressUrl2;
$flag = true;
}
if (!isN($videoAddressUrl1)) {
if ($flag) {
$videoAddressUrl = $videoAddressUrl . MovieType::VIDEO_SEP_VERSION;
}
$videoAddressUrl = $videoAddressUrl . $videoAddressUrl1;
$flag = true;
}
// var_dump($videoAddressUrl);
return $videoAddressUrl;
}