本文整理汇总了PHP中JDate::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP JDate::__toString方法的具体用法?PHP JDate::__toString怎么用?PHP JDate::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDate
的用法示例。
在下文中一共展示了JDate::__toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testToString
/**
* Testing toString
*
* @param string $format How should the time be formatted?
* @param string $expectedTime What should the resulting time string look like?
*
* @return void
*
* @dataProvider casesToString
* @since 11.3
* @covers JDate::__toString
*/
public function testToString($format, $expectedTime)
{
if (!is_null($format)) {
JDate::$format = $format;
}
$this->assertThat($this->object->__toString(), $this->equalTo($expectedTime));
}
示例2: add
/**
* Set a data that is going to be stored and save it.
*
* <code>
* $title = "My title...";
* $type = "MY_TYPE";
* $data = array(
* "amount" => 100,
* "currency" => "USD"
* );
*
* $file = "/logs/com_crowdfunding.log";
* $writer = new PrismLogWriterFile($file);
*
* $log = new PrismLog();
* $log->addWriter($writer);
*
* $log->add($title, $type, $data);
* </code>
*
* @param string $title
* @param string $type
* @param mixed $data
*/
public function add($title, $type, $data = null)
{
$this->setTitle($title);
$this->setType($type);
$this->setData($data);
$date = new \JDate();
$this->setRecordDate($date->__toString());
$this->store();
}