当前位置: 首页>>代码示例>>PHP>>正文


PHP Filter::filterString方法代码示例

本文整理汇总了PHP中Filter::filterString方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::filterString方法的具体用法?PHP Filter::filterString怎么用?PHP Filter::filterString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Filter的用法示例。


在下文中一共展示了Filter::filterString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testFilterString

 public function testFilterString()
 {
     $this->assertEquals(Filter::filterString('  <b><?php echo "biber"; ?></b>what? '), 'what?');
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:4,代码来源:FilterTest.php

示例2: getTrailByTrailUuid

 public static function getTrailByTrailUuid(PDO &$pdo, $trailUuid)
 {
     //sanitize the trailUuid before searching
     try {
         $trailUuid = Filter::filterString($trailUuid, "trailUuid");
     } catch (InvalidArgumentException $invalidArgument) {
         throw new PDOException($invalidArgument->getMessage(), 0, $invalidArgument);
     } catch (RangeException $range) {
         throw new PDOException($range->getMessage(), 0, $range);
     } catch (Exception $exception) {
         throw new PDOException($exception->getMessage(), 0, $exception);
     }
     //create query template
     $query = "SELECT trailId, userId, browser, createDate, ipAddress, submitTrailId, trailAmenities, trailCondition,trailDescription, trailDifficulty, trailDistance, trailName, trailSubmissionType,\ntrailTerrain, trailTraffic, trailUse, trailUuid FROM trail WHERE trailUuid = :trailUuid";
     $statement = $pdo->prepare($query);
     //bind trailUuid to placeholder
     $parameters = array("trailUuid" => $trailUuid);
     $statement->execute($parameters);
     //build an array of trails
     $trails = new SplFixedArray($statement->rowCount());
     $statement->setFetchMode(PDO::FETCH_ASSOC);
     while (($row = $statement->fetch()) !== false) {
         try {
             //new trail ($trailId, $userId, $submitTrailId, $browser, $createDate, $ipAddress, $trailAccessibility, $trailAmenities, $trailCondition,$trailDescription, $trailDifficulty, $trailDistance, $trailSubmissionType,$trailTerrain, $trailName, $trailTraffic, $trailUse, $trailUuId)
             $trail = new Trail($row["trailId"], $row["userId"], $row["browser"], $row["createDate"], $row["ipAddress"], $row["submitTrailId"], $row["trailAmenities"], $row["trailCondition"], $row["trailDescription"], $row["trailDifficulty"], $row["trailDistance"], $row["trailName"], $row["trailSubmissionType"], $row["trailTerrain"], $row["trailTraffic"], $row["trailUse"], $row["trailUuid"]);
             $trails[$trails->key()] = $trail;
             $trails->next();
         } catch (Exception $e) {
             //if the row couldn't be converted, rethrow it
             throw new PDOException($e->getMessage(), 0, $e);
         }
     }
     return $trails;
 }
开发者ID:jmsaul,项目名称:open-trails,代码行数:34,代码来源:trail.php

示例3: viewDbAction

 public function viewDbAction()
 {
     $serverId = Request::post('server_id', 'pagecode', '');
     if (!strlen($serverId)) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     $serverDir = $this->_deployConfig->get('datadir') . $serverId . '/';
     $info = array();
     $date = '---';
     if (file_exists($serverDir . 'lastfsupdate')) {
         $date = Filter::filterString(@file_get_contents($serverDir . 'lastdbupdate'));
     }
     if (file_exists($serverDir . 'db.php')) {
         $info = (include $serverDir . 'db.php');
     }
     $data = array('info' => $info, 'date' => $date);
     Response::jsonSuccess($data);
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:18,代码来源:Controller.php


注:本文中的Filter::filterString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。