本文整理汇总了PHP中Stock::getLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Stock::getLink方法的具体用法?PHP Stock::getLink怎么用?PHP Stock::getLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stock
的用法示例。
在下文中一共展示了Stock::getLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
function search()
{
$cacheData = FileCache::get('__cache__' . $this->keyword);
if (!$cacheData) {
$url = $this->queryUrl . urlencode($this->keyword);
$request_result = $this->request($url);
$json = json_decode($request_result);
$searchData = $json->data;
if (count($searchData) > 0) {
FileCache::set('__cache__' . $this->keyword, $searchData, 24 * 60 * 60);
}
} else {
$searchData = $cacheData;
}
if (count($searchData) > 0) {
$codeArray = array();
foreach ($searchData as $value) {
$d = explode('~', $value);
if (preg_match('/(\\..*)$/', $d[1], $re)) {
$d[1] = str_replace($re[1], "", $d[1]);
}
if ($d[0] == 'us') {
$d[1] = strtoupper($d[1]);
}
$dCode = $d[0] . $d[1];
if ($d[0] == 'hk') {
$dCode = 'r_' . $dCode;
}
if ($d[0] == 'jj') {
$dCode = 's_' . $dCode;
}
array_push($codeArray, $dCode);
}
$qt = new StockQt();
$qt->fetchQt(implode(',', $codeArray));
foreach ($searchData as $key => $value) {
$stock = new Stock($value, $qt);
$this->result($key, $stock->getLink(), $stock->getTitle(), $stock->getSubTitle(), null);
}
} else {
$this->lastPlaceholder();
}
}
示例2: search
function search()
{
$qtData = FileCache::get($this->keyword);
if (!$qtData) {
$url = $this->queryUrl . urlencode($this->keyword);
$request_result = $this->request($url);
$json = json_decode($request_result);
$qtData = $json->data;
}
if (count($qtData) > 0) {
FileCache::set($this->keyword, $qtData);
foreach ($qtData as $key => $value) {
$stock = new Stock($value);
$this->result($key, $stock->getLink(), $stock->getTitle(), $stock->getSubTitle(), null);
}
} else {
$this->lastPlaceholder();
}
}