本文整理汇总了PHP中MyClass::doSomething方法的典型用法代码示例。如果您正苦于以下问题:PHP MyClass::doSomething方法的具体用法?PHP MyClass::doSomething怎么用?PHP MyClass::doSomething使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyClass
的用法示例。
在下文中一共展示了MyClass::doSomething方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSomething
use Gelembjuk\Locale\GetTextTrait;
public function doSomething()
{
echo $this->getText('welcome') . '<br>';
}
public function andAgainWelcome($name)
{
// use short call for getText
echo $this->_('hello', '', $name) . '<br>';
echo $this->_('contact', 'frontpage') . '<br>';
}
}
$obj = new MyClass();
// this meathod comes from a trait
$obj->setTranslation($translation);
$obj->doSomething();
$obj->andAgainWelcome($username);
echo '<br><br>';
// change to english
$obj->setLocale('en');
// and repeat
$obj->andAgainWelcome($username);
// =============================================================
echo '<h1>Test 3. Show language change select box</h1>';
// output form to change locale
$languages = new Gelembjuk\Locale\Languages(array('localespath' => $lang_folder_path));
echo '<hr><form name=\'langform\' method=\'GET\' action="index.php">';
echo $languages->getHTMLSelect(' name="locale" onchange="document.langform.submit()" ', $locale);
echo '</form>';
// =============================================================
// output EU languages
示例2: doSomething
<?php
interface MyInterface1
{
public function doSomething();
public function specialFunction1();
}
interface MyInterface2
{
public function doSomething();
// Prior to PHP 5.3.9 => FATAL ERROR
public function specialFunction2();
}
class MyClass implements MyInterface1, MyInterface2
{
function doSomething()
{
echo '...';
}
function specialFunction1()
{
echo '...';
}
function specialFunction2()
{
echo '...';
}
}
$a = new MyClass();
$a->doSomething();