本文整理汇总了PHP中Str::finish方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::finish方法的具体用法?PHP Str::finish怎么用?PHP Str::finish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Str
的用法示例。
在下文中一共展示了Str::finish方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($query, &$conn, &$orm = null)
{
$this->conn = $conn;
$this->res = null;
$this->orm = $orm;
$this->rowOrm = null;
$this->success = false;
$this->fields = null;
$this->EOF = true;
$this->BOF = true;
$this->index = 0;
$this->count = 0;
$this->insertID = 0;
$type = strtolower(substr(trim(str_replace("\n", " ", $query)), 0, 7));
$typeIsSelect = $type == "select ";
$typeIsShowTables = $type == "show ta";
$typeIsInsert = $type == "insert ";
$query = Str::finish($query, ";");
if ($this->res = @mysql_query($query, $this->conn->res)) {
$this->success = true;
if ($typeIsSelect || $typeIsShowTables) {
$this->count = mysql_num_rows($this->res);
$this->moveFirst();
} else {
if ($typeIsInsert) {
$this->insertID = mysql_insert_id($this->conn->res);
}
}
} else {
trigger_error("SQL error: " . $query . "\n<br><b>'" . mysql_error($this->conn->res) . "'</b>");
}
}
示例2: bindUrls
/**
* Bind URLs
*
* @return void
*/
public function bindUrls()
{
$root = \Str::finish(URL::to('/'), '/');
$urls = ['root' => $root, 'feed' => $root . 'feed', 'archives' => $root . 'archives', 'search' => $root . 'search', 'assets' => $root . 'assets'];
foreach ($urls as $key => $value) {
App::instance("url.{$key}", $value);
}
}
示例3: str_finish
/**
* Cap a string with a single instance of a given value.
*
* @param string $value
* @param string $cap
* @return string
*/
function str_finish($value, $cap)
{
return Str::finish($value, $cap);
}
示例4: formatDir
public static function formatDir($path)
{
return Str::finish($path, DS);
}
示例5: rootURL
public static function rootURL()
{
if (is_null(static::$rootURL)) {
$protocol = strtolower(array_get(static::$server, "SERVER_PROTOCOL", "http"));
$protocol = substr($protocol, 0, strpos($protocol, "/")) . (static::isSecure() ? "s" : "");
$port = array_get(static::$server, "SERVER_PORT", "80");
$port = $port == "80" ? "" : ":" . $port;
if (static::isPreview() && $port == ":8080") {
$port = "";
}
$uri = static::fullURI();
$pathInfo = static::pathInfo();
if ($pathInfo != "/") {
$uri = substr($uri, 0, strpos($uri, $pathInfo));
}
$uri = explode("?", $uri);
$uri = $uri[0];
static::$rootURL = Str::finish($protocol . "://" . array_get(static::$server, "SERVER_NAME", "localhost") . $port . $uri, "/");
}
return static::$rootURL;
}