コード例 #1
0
ファイル: Cookie.php プロジェクト: ph-7/cookiesession
 /**
  * Get Cookie.
  *
  * @param string $sName Name of the cookie.
  * @param boolean $bEscape Default TRUE
  * @return string If the cookie exists, returns the cookie with function escape() (htmlspecialchars) if escape is enabled. Empty string value if the cookie does not exist.
  */
 public function get(string $sName, bool $bEscape = true) : string
 {
     $sCookieName = $this->getPrefix() . $sName;
     return isset($_COOKIE[$sCookieName]) ? $bEscape ? Various::escape($_COOKIE[$sCookieName]) : $_COOKIE[$sCookieName] : '';
 }
コード例 #2
0
ファイル: Session.php プロジェクト: ph-7/cookiesession
 /**
  * Get Session.
  *
  * @param string $sName Name of the session.
  * @param boolean $bEscape Default TRUE
  * @return string If the session exists, returns the session with function escape() (htmlspecialchars) if escape is enabled. Empty string value if the session does not exist.
  */
 public function get(string $sName, bool $bEscape = true) : string
 {
     $sSessionName = $this->getPrefix() . $sName;
     return isset($_SESSION[$sSessionName]) ? $bEscape ? Various::escape($_SESSION[$sSessionName]) : $_SESSION[$sSessionName] : '';
 }