PHP 判断是否为 AJAX 请求
可以使用 PHP 的 $_SERVER[HTTP_X_REQUESTED_WITH] 全局变量来判断: ```php if (!empty($_SERVER[HTTP_X_REQUESTED_WITH]) &&
2023-07-02 08:21
148 
PHP保留两位小数的几种方法
1. 使用 number_format() 函数: ``` echo number_format(1.2, 2); // 输出 1.20 ``` 2. 使用 sprintf() 函数: ``` echo s
2023-07-02 08:21
125 
php通过SSH通道来访问MySQL
可以使用第三方库来实现,例如PHPSECLIB: 1. 安装PHPSECLIB库: $ sudo apt-get install libssh2-php 2. 连接到SSH服务器: $conn = new
2023-07-02 08:21
125 
PHP 获取文件扩展名(后缀名)的方法
1. 使用pathinfo()函数: ``` $file_name = example.txt; $file_ext = pathinfo($file_name, PATHINFO_EXTENSION); ec
2023-07-02 08:21
119 
php中mysql手动提交事务和在for循环里进行事务控制及声明式事务的使用
1. mysql手动提交事务: 在MySQL中,使用commit语句可以手动提交事务,其语法如下: commit; 2.在for循环里进行事务控制 在for循环中使用事务,可以使用begin和commit
2023-07-02 08:22
124 
47001 data format error hint 解析 JSON/XML 内容错误
The error message 47001 Data Format Error typically indicates that an error occurred while attempting to p
2023-07-02 08:22
119 
str_replace替换多个关键字
str_replace(array(str1,str2),replace_str,subject);
2023-07-02 08:22
113 
PHP隐藏部分字符串(如:姓名、用户名、身份证、IP、手机号等)
1、使用PHP中的substr()函数: ``` $str = ‘123456789’; echo substr($str, 0, 3) . ‘‘ . substr($str, -3); // 输出:123789 `
2023-07-02 08:28
132 
T:0.009329s,M:195.45 KB
返回顶部 留言