当前位置: 首页>>代码示例>>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;未经允许,请勿转载。