2023-07-02 08:21
106
0
0
0
1. 使用pathinfo()函数:
```
$file_name = "example.txt";
$file_ext = pathinfo($file_name, PATHINFO_EXTENSION);
echo $file_ext; // 输出:txt
```
2. 使用strrchr()函数:
```
$file_name = "exam
2023-07-02 08:21
112
0
0
0
可以使用第三方库来实现,例如PHPSECLIB:
1. 安装PHPSECLIB库:
$ sudo apt-get install libssh2-php
2. 连接到SSH服务器:
$conn = new \phpseclib\Net\SSH2('example.com');
$conn->login('username', 'password
2023-07-02 08:21
113
0
0
0
1. 使用 number_format() 函数:
```
echo number_format(1.2, 2); // 输出 1.20
```
2. 使用 sprintf() 函数:
```
echo sprintf("%.2f", 1.2); // 输出 1.20
```
3. 使用 round() 函数:
```
echo round(1
2023-07-02 08:21
132
0
0
0
可以使用 PHP 的 $_SERVER['HTTP_X_REQUESTED_WITH'] 全局变量来判断:
```php
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
2023-07-01 08:20
107
0
0
0
openssl_decrypt() 方法是用于对称加密的替代 mcrypt_module_open() 方法的一种更新方法,它使用 OpenSSL 库来提供更安全和更强大的加密功能。它的安全级别比 mcrypt_module_open() 方法更高,因为它利用了更新的密码学技术。
2023-07-01 08:19
123
0
0
0
#### 安装
```
composer require phpoffice/phpspreadsheet
```
#### 导入
```
2023-07-01 08:14
108
0
0
0
方法一:使用substr函数
可以使用substr函数来实现隐藏部分字符,可以将要显示的文字截取指定长度,其余部分用点号或其他字符替换,如:
$str = 'hello world';
$str_sub = substr($str, 0, 5).'...';
方法二:使用str_replace函数
可以使用str_replace函数将要隐藏的部分
2023-06-30 09:44
105
0
0
0
方法一:
1. 打开phpMyAdmin文件夹,找到“config.inc.php”文件,用记事本打开。
2. 在文件中找到“$cfg['Servers'][$i]['port']”,其中$i一般是0,也可以是其他值。
3. 修改端口号,将其修改成你要的端口号,然后保存文件。
方法二:
1. 打开MySQL安装目录下的“my.ini”文件,或者