本文整理汇总了PHP中str::word方法的典型用法代码示例。如果您正苦于以下问题:PHP str::word方法的具体用法?PHP str::word怎么用?PHP str::word使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类str
的用法示例。
在下文中一共展示了str::word方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
<?php
try {
$tpl = $PAGE->start();
@ini_set('default_charset', NULL);
header('Content-type: text/css');
$css = str::word($PAGE->ext[0], true);
if ($css != '') {
setCookie(COOKIE_A . 'page_css', $css, $_SERVER['REQUEST_TIME'] + DEFAULT_LOGIN_TIMEOUT, COOKIE_PATH, COOKIE_DOMAIN);
} else {
$css = $_COOKIE[COOKIE_A . 'page_css'];
}
if ($css == '') {
$css = 'default';
}
$tpl->display($x = 'tpl:css.wap_' . $css . '.css');
} catch (exception $ERR) {
throw $ERR;
}
示例2: tplPath
public function tplPath($name, $ext = '.tpl')
{
if (isset($this->tplCache[$ext][$name])) {
return $this->tplCache[$ext][$name];
}
$info = explode('.', $name);
if (count($info) == 1) {
$cid = $PAGE['cid'];
$pid = str::word($name, true);
$bid = $PAGE['bid'];
} elseif (count($info) == 2) {
$cid = str::word($info[0], true);
$pid = str::word($info[1], true);
$bid = $PAGE['bid'];
} else {
$cid = str::word($info[0], true);
$pid = str::word($info[1], true);
$bid = str::word($info[2], true);
}
if ($cid == '') {
$cid = $this->page['cid'];
}
if ($pid == '') {
$pid = $this->page['pid'];
}
if ($bid == '') {
$bid = $this->page['bid'];
}
$tpl = $this->page['tpl'];
if ($tpl != 'default') {
$path = TPL_DIR . "/{$tpl}/{$cid}/{$pid}.{$bid}{$ext}";
if (!is_file($path)) {
$path = TPL_DIR . "/{$tpl}/{$cid}/{$pid}{$ext}";
}
}
if ($tpl == 'default' || !is_file($path)) {
$path = PAGE_DIR . "/{$cid}/{$pid}.{$bid}{$ext}";
}
if (!is_file($path)) {
$path = PAGE_DIR . "/{$cid}/{$pid}{$ext}";
}
if (!is_file($path)) {
if ($ext == '.tpl') {
$type = '模板';
$code = 2404;
} elseif ($ext == '.conf') {
$type = '配置';
$code = 3404;
} else {
$type = 'Smarty';
$code = 4404;
}
throw new pageexception("{$type}文件 \"{$name}\" 不存在", $code);
}
$this->tplCache[$ext][$name] = $path;
return $path;
}