本文整理匯總了PHP中Stock::getTitle方法的典型用法代碼示例。如果您正苦於以下問題:PHP Stock::getTitle方法的具體用法?PHP Stock::getTitle怎麽用?PHP Stock::getTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Stock
的用法示例。
在下文中一共展示了Stock::getTitle方法的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();
}
}