
PHP
Cmddd豆
这个作者很懒,什么都没留下…
展开
-
PHP读取sqlserver数据使用json_decode没有返回值
$sql = "SELECT a FROM `table_a`"; 首先检测搜索得到的字符串的编码类型 mb_detect_encoding($row['a'], array("ASCII",'UTF-8',"GB2312","GBK",'BIG5')); 如果得到的编码类型不是"UTF-8",则无法使用json_decode进行编码。 当编码为"ASCII",转换成"UTF-8":...原创 2020-05-06 13:04:57 · 411 阅读 · 0 评论 -
PHP SQL语句某字段含有单引号('),执行报错 详解
$a = "a'b"; $sql = "INSERT INTO `aa`(`txt`) VALUES ('$a')"; $result = mysql_query($sql); //-----执行报错 使用addslashes() 函数 在预定义字符之前添加反斜杠的字符串 $a = addslashes($a); addslashes() 函数知识点入口 ...原创 2020-04-24 14:20:36 · 1019 阅读 · 0 评论 -
PHP include多个不同的PHP文件无法执行
include("C:/xampp/htdocs/demoWe/sendEmail.php"); echo "1<br/>"; include("C:/xampp/htdocs/demoWe/sendWechat.php"); echo "2<br/>"; //只能输出1 //当某一行include被注释时,输出1<br/>2 原因查明:倆PHP...原创 2020-03-04 14:57:52 · 652 阅读 · 0 评论 -
JS/PHP 获取字符串第一位
//JS: 获取字符串第一位 var a = test; console.log(a[0]);//t //PHP:获取字符串第一位 var a = test; echo substr($a,0,1);//t原创 2019-07-29 15:51:33 · 1731 阅读 · 0 评论 -
php 两数组差值
$a 大数组 包含$b $b 小数组 array_diff($a,$b); <?php $a = array("a","b","c"); //Array //( // [0] => a // [1] => b // [2] => c //) $b = array("a","b"); //Array //( // [0] => a //...原创 2019-07-25 15:08:26 · 1148 阅读 · 0 评论 -
PHP 表单提交处理单域多文件
<?php $idid = $_GET['$idid'];//从提交页面获取的id $uploadFile = $_FILES['uploadFile'];//从提交页面获取文件数据 $targetDir = __DIR__."/oiUpload/".$idid;//创建独立文件夹 if (!file_exists($targetDir)) {mkdir($targetDir...原创 2019-07-26 08:40:15 · 188 阅读 · 0 评论 -
PHP For 循环报错Maximum execution time of 30 seconds exceeded
PHP中运行For循环报"Maximum execution time of 30 seconds exceeded"的错误 解决方法(共仨) 修改php配置文件php.ini文件[php.ini文件中修改] max_execution_time = 60 ;//以秒为单位 max_execution_time = 0 ;//无限制 使用 ini_set() 函数...原创 2019-10-09 15:29:55 · 200 阅读 · 0 评论 -
$i>>$j&1代表的是?
$i = 8; $j = 2; echo $i >> $j;//2,$i/2的$j次方 echo $i << $j;//32,$i*2的$j次方 echo $i >> $j & 1 ; //0。(奇偶性判断)整数与“1”进行按位与运算,运算结果为“0”表示为偶数,运算结果为“1”表示为奇数 ...原创 2019-10-10 11:26:41 · 1064 阅读 · 0 评论