本文整理汇总了PHP中StringUtils::startsWith方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtils::startsWith方法的具体用法?PHP StringUtils::startsWith怎么用?PHP StringUtils::startsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtils
的用法示例。
在下文中一共展示了StringUtils::startsWith方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testStartsWith
/**
* Test for Schwaen\Stdlib\StringUtils::startsWith
*/
public function testStartsWith()
{
$this->assertEquals(false, StringUtils::startsWith('Hallo Welt', 'hallo'));
$this->assertEquals(true, StringUtils::startsWith('Hallo Welt', 'Hallo'));
$this->assertEquals(false, StringUtils::startsWith('Hallo Welt', 'Test'));
$this->assertEquals(true, StringUtils::startsWith('Hallo Welt', ''));
}
示例2: __call
public function __call($name, $value)
{
if (StringUtils::startsWith($name, "set")) {
$this->executeSetter($name, $value);
} else {
if (StringUtils::startsWith($name, "get")) {
$this->executeGetter($name);
}
}
}
示例3: __call
public function __call($name, array $args)
{
if (StringUtils::startsWith($name, "get") && strlen($name) != 3) {
$name = ucfirst(substr($name, 3));
if (isset($this->_data[$name])) {
return $this->_data[$name];
}
return null;
}
throw new Exception("Unknown method {$name}!");
}
示例4: resolveURI
protected function resolveURI($uri)
{
if (empty($uri) || StringUtils::startsWith($uri, '/')) {
return rtrim($this->routerBase, '/') . '/' . ltrim($uri, '/');
}
//return $this->RequestContext->getSite()->getBaseURL().'/'.ltrim($uri, '/');
return $uri;
}
示例5: testStartsWithFail
/**
* @covers StringUtils::startsWith
*/
public function testStartsWithFail()
{
$haystack = "fruition sciences";
$needle = "Fruit";
$response = \StringUtils::startsWith($haystack, $needle);
$this->assertFalse($response);
}
示例6: detectMethodSignature
private static function detectMethodSignature($name)
{
require_once 'platform/stdlib/StringUtils.php';
if (StringUtils::startsWith($name, self::METHOD_SIGNATURE_GET)) {
return self::METHOD_SIGNATURE_GET;
}
if (StringUtils::startsWith($name, self::METHOD_SIGNATURE_SET)) {
return self::METHOD_SIGNATURE_SET;
}
return null;
}
示例7: write_mind
function write_mind($message, $origin_id, $attach_pic = false, $autopost_fb = 0, $autopost_tw = 0)
{
$params = array('message' => $message, 'origin_id' => $origin_id, 'autopost_fb' => $autopost_fb, 'autopost_tw' => $autopost_tw, 'access_token' => $this->access_token, 'rf' => $this->rf);
if ($attach_pic) {
if (!StringUtils::startsWith($attach_pic, '@')) {
$attach_pic = sprintf('%s%s', '@', $attach_pic);
}
$params['attach_pic'] = $attach_pic;
}
$conn = new Http('POST', $this->getApiHost('/post/write_mind'), $params);
return $conn->execute();
}