本文整理匯總了PHP中Zend_Text_Table::getInputCharset方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Text_Table::getInputCharset方法的具體用法?PHP Zend_Text_Table::getInputCharset怎麽用?PHP Zend_Text_Table::getInputCharset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Text_Table
的用法示例。
在下文中一共展示了Zend_Text_Table::getInputCharset方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setContent
/**
* Set the content.
*
* If $charset is not defined, it is assumed that $content is encoded in
* the charset defined via Zend_Text_Table::setInputCharset() (defaults
* to utf-8).
*
* @param string $content Content of the column
* @param string $charset The charset of the content
* @throws Zend_Text_Table_Exception When $content is not a string
* @return Zend_Text_Table_Column
*/
public function setContent($content, $charset = null)
{
if (is_string($content) === false) {
require_once 'Zend/Text/Table/Exception.php';
throw new Zend_Text_Table_Exception('$content must be a string');
}
if ($charset === null) {
$inputCharset = Zend_Text_Table::getInputCharset();
} else {
$inputCharset = strtolower($charset);
}
$outputCharset = Zend_Text_Table::getOutputCharset();
if ($inputCharset !== $outputCharset) {
if (PHP_OS !== 'AIX') {
// AIX does not understand these character sets
$content = iconv($inputCharset, $outputCharset, $content);
}
}
$this->_content = $content;
return $this;
}