本文整理匯總了PHP中StringUtils::isEmpty方法的典型用法代碼示例。如果您正苦於以下問題:PHP StringUtils::isEmpty方法的具體用法?PHP StringUtils::isEmpty怎麽用?PHP StringUtils::isEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類StringUtils
的用法示例。
在下文中一共展示了StringUtils::isEmpty方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: makeConnectorFromFile
public function makeConnectorFromFile($fileName)
{
if (StringUtils::isEmpty($fileName)) {
throw new Exception('Invalid db config file name: ' . $fileName);
}
@(include $fileName);
if (StringUtils::isEmpty($configDbDsn) || StringUtils::isEmpty($configDbUsername) || StringUtils::isEmpty($configDbPassword)) {
throw new Exception('Invalid db config file: ' . $fileName . "\n" . 'Remember that empty db passwords are not allowed!');
}
return new DbConnector($configDbDsn, $configDbUsername, $configDbPassword);
}
示例2: init
protected function init()
{
$requestString = file_get_contents('php://input');
if (StringUtils::isEmpty($requestString)) {
return;
}
$requestData = XMLRPC_parse($requestString);
$methodStrings = explode('.', XMLRPC_getMethodName($requestData));
$this->methodOwner = $methodStrings[0];
$this->methodName = $methodStrings[1];
$this->methodParams = XMLRPC_getParams($requestData);
// TODO: Where to call session_start?
session_start();
$this->session = new PhpHttpSession();
}
示例3: addEntry
public function addEntry($caption, $author, $drawingString)
{
// TODO: Accept Entry object as parameter?
// TODO: Validity checks here or in the server?
if (StringUtils::isEmpty($caption)) {
throw new InvalidParameterException("caption must not be empty.");
}
if (StringUtils::isEmpty($author)) {
throw new InvalidParameterException("author must not be empty.");
}
if (StringUtils::isEmpty($drawingString)) {
throw new InvalidParameterException("drawingString must not be empty.");
}
// TODO: Cache statement?
$statement = $this->dbConn->getPdo()->prepare('INSERT INTO entries ( id, caption, author, drawingString, timestamp ) ' . 'VALUES ( NULL, :caption, :author, :drawingString, UTC_TIMESTAMP );');
$statement->execute(array(':caption' => $caption, ':author' => $author, ':drawingString' => $drawingString));
return $this->dbConn->getPdo()->lastInsertId();
}