本文整理汇总了PHP中Engine::startsWith方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::startsWith方法的具体用法?PHP Engine::startsWith怎么用?PHP Engine::startsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine::startsWith方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_startsWith
public function test_startsWith()
{
//This test, tests against the function startsWith which is used to detect if a string starts in a string
//A good example is to test if a string starts with hello in "helloworld"
$this->assertEquals(true, Engine::startsWith("helloworld", "hello"));
//Here we make sure it actually works by giving it a wrong value, we expect to get false
$this->assertEquals(false, Engine::startsWith("helloworld", "world"));
}
示例2: getRemoteAbsolutePath
public static function getRemoteAbsolutePath($path)
{
//Returns nothing if the path is already an absolute address
if (Engine::startsWith($path, "http://") || Engine::startsWith($path, "https://")) {
return $path;
}
//Returns the absolute address of the provided path.
//(e.g. /Hello/World & /Foo/Bar become http://localhost/Hello/World/Foo/Bar)
return self::$protocol . self::$host . self::getRemoteDir($path);
}