當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Str::replaceSpecialChars方法代碼示例

本文整理匯總了PHP中Str::replaceSpecialChars方法的典型用法代碼示例。如果您正苦於以下問題:PHP Str::replaceSpecialChars方法的具體用法?PHP Str::replaceSpecialChars怎麽用?PHP Str::replaceSpecialChars使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Str的用法示例。


在下文中一共展示了Str::replaceSpecialChars方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: trim

<?php

// ENREGISTREMENT
if (isset($_POST['saveserver'])) {
    // Variables
    $serverName = Str::replaceSpecialChars(htmlspecialchars(addslashes($_POST['addServerName'])), false);
    $serverAddress = trim($_POST['addServerAddress']);
    $serverPort = intval($_POST['addServerPort']);
    $serverMapsBasePath = trim($_POST['addServerMapsBasePath']);
    $serverMatchSet = trim($_POST['addServerMatchSet']);
    $serverAdmLvl = array('SuperAdmin' => $_POST['addServerAdmLvlSA'], 'Admin' => $_POST['addServerAdmLvlADM'], 'User' => $_POST['addServerAdmLvlUSR']);
    $isNotAnArray = array('all', 'local', 'none');
    foreach ($serverAdmLvl as $admLvlId => $admLvlValue) {
        if (!in_array($admLvlValue, $isNotAnArray)) {
            $serverAdmLvl[$admLvlId] = explode(',', $admLvlValue);
        } else {
            $serverAdmLvl[$admLvlId] = trim($admLvlValue);
        }
    }
    $serverData = array('name' => $serverName, 'address' => $serverAddress, 'port' => $serverPort, 'mapsbasepath' => $serverMapsBasePath, 'matchsettings' => $serverMatchSet, 'adminlevel' => array());
    foreach ($serverAdmLvl as $admLvlId => $admLvlValue) {
        $serverData['adminlevel'][$admLvlId] = $admLvlValue;
    }
    // Édition
    if ($args['id'] !== -1) {
        if (($result = AdminServServerConfig::saveServerConfig($serverData, $args['id'])) !== true) {
            AdminServ::error(Utils::t('Unable to modify the server.') . ' (' . $result . ')');
        } else {
            $action = Utils::t('This server has been modified.');
            AdminServ::info($action);
            AdminServLogs::add('action', $action);
開發者ID:keverage,項目名稱:adminserv,代碼行數:31,代碼來源:config-addserver.php

示例2: array

<?php

// ENREGISTREMENT
if (isset($_POST['savelevel'])) {
    // Variables
    $levelName = Str::replaceSpecialChars(htmlspecialchars(addslashes($_POST['addLevelName'])), false);
    $levelType = $_POST['addLevelType'];
    $levelAccess = array();
    if ($_POST['selectedAccessSortList']) {
        $levelAccess = explode(',', $_POST['selectedAccessSortList']);
    }
    $levelPermission = array();
    if ($_POST['selectedPermissionSortList']) {
        $levelPermission = explode(',', $_POST['selectedPermissionSortList']);
    }
    $levelData = array('name' => $levelName, 'adminlevel' => array('type' => $levelType), 'access' => $levelAccess, 'permission' => $levelPermission);
    // Édition
    if ($args['id'] !== -1) {
        if (($result = AdminServAdminLevel::saveConfig($levelData, $args['id'])) !== true) {
            AdminServ::error(Utils::t('Unable to modify the admin level.') . ' (' . $result . ')');
        } else {
            $action = Utils::t('This admin level has been modified.');
            AdminServ::info($action);
            AdminServLogs::add('action', $action);
            Utils::redirection(false, '?p=config-adminlevel');
        }
    } else {
        if (($result = AdminServAdminLevel::saveConfig($levelData)) !== true) {
            AdminServ::error(Utils::t('Unable to add the admin level.') . ' (' . $result . ')');
        } else {
            $action = Utils::t('This admin level has been added.');
開發者ID:keverage,項目名稱:adminserv,代碼行數:31,代碼來源:config-addlevel.php


注:本文中的Str::replaceSpecialChars方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。