JavaScript 的 encodeURIcomponent 函数在 PHP 中的等价物是什么?
What is the equivalent of JavaScript's encodeURIcomponent function in PHP?
Try rawurlencode.或者更准确地说:
Try rawurlencode. Or to be more precise:
function encodeURIComponent($str) {
$revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')');
return strtr(rawurlencode($str), $revert);
}
此功能完全正常如何encodeURIComponent 已定义:
This function works exactly how encodeURIComponent is defined:
encodeURIComponent 转义除以下字符之外的所有字符:字母、十进制数字、- _ . ! ~ * ' ( )
encodeURIComponentescapes all characters except the following: alphabetic, decimal digits,-_.!~*'()
这篇关于PHP 中 JavaScript 的 encodeURI 组件的等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
PHP、MySQL PDOException 的死锁异常代码?Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死锁异常代码?)
PHP PDO MySQL 可滚动游标不起作用PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滚动游标不起作用)
PHP PDO ODBC 连接PHP PDO ODBC connection(PHP PDO ODBC 连接)
使用 PDO::FETCH_CLASS 和魔术方法Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔术方法)
php pdo 只从 mysql 获取一个值;等于变量的值php pdo get only one value from mysql; value that equals to variable(php pdo 只从 mysql 获取一个值;等于变量的值)
MSSQL PDO 找不到驱动程序MSSQL PDO could not find driver(MSSQL PDO 找不到驱动程序)