ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## RSA数据加密 > rsa_encrypt(string $data, string $publicKey): string | 参数 | 类型 | 必须 | 说明 | | --- | --- | --- | --- | | `$data` | string | 是 | 待加密数据 | | `$publicKey` | string | 是 | RSA公钥 | 返回值:string 类型 > 示例: ```php $data = "123456"; $publicKey= "**************************"; $encrypted = rsa_encrypt($data,$publicKey); dump($encrypted); // 输出:FWHx+J7vrgR1DfqPjDZtEudrp9au/SgmqKCjJZERj7bVdjsVMbRwDn8lYFDTIqeiFlDaDoLvSQXjmpp/QkTLGsG5BmxQjgghauXmNnuWlZkbs5AMiyx1jFA4vbRlCT3k6272MtzGqDXP9U3hyd6iFkC2JnIF/GNiBZk1mDZVpcHLtUttEcdTQrYWOBBu1b/8O2AilTDNauWxvb7C4DHyUdxJ9VpVBUBlIQoYQK/N+SMQbvF2GNHofDUFGMujYOTmMOxsIr16dYppAjzAV/n9tYm3QqBvtfsCyZHohjruhfhBTow9KEVLUk6ZLbZgTY2e7QigxkRfnrrHLnzJ/UJBkQ== ```