
php
糟糕的沙漠
这个作者很懒,什么都没留下…
展开
-
wampserver简单配置
wampserver简单配置原创 2022-09-11 20:50:05 · 1242 阅读 · 1 评论 -
PHP查询结果限制条数
1 传统 LIMIT 初始位置,记录数 查询SELECT * FROM user OREDER BY ID LIMIT 100,102 配合 WHERE 查询SELECT * FROM user WHERE ID > 100 ORDER BY ID LIMIT 10-- 这里ID为自增主键(int型)原创 2022-05-05 13:50:16 · 1368 阅读 · 0 评论 -
php curl简单使用
php curl模拟登陆,获取cookie,从端口获取信息。$post = array( 'password'=>'', 'username'=>'');// 网站登陆$url = "http://localhost/index.php?c=Login&f=loginCheck";// cookie存放地址$cookie = dirname(__FILE__) . '/cookie.txt';// login_post($url, $cookie, $po原创 2021-11-06 19:19:19 · 169 阅读 · 0 评论 -
php 打印报错
在php页面添加error_reporting(E_ALL);ini_set("display_errors","On");原创 2021-10-20 18:10:40 · 177 阅读 · 0 评论 -
PHP json
https://my.oschina.net/u/1414906/blog/223194原创 2021-06-29 09:11:48 · 115 阅读 · 0 评论 -
php统计字符串中字母,数字,中文个数
https://www.jb51.net/article/38941.htmecho $str = "测试一下1qwe23454dsf3fdffdsfadaf4f";preg_match_all("/[0-9]{1}/",$str,$arrNum);preg_match_all("/[a-zA-Z]{1}/",$str,$arrAl);preg_match_all("/([\x{4e00}-\x{9fa5}]){1}/u",$str,$arrCh);echo "<pre>";echo转载 2021-06-25 16:55:26 · 1563 阅读 · 0 评论 -
PHP将图片转换为png格式
PHP将图片转换为png格式<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src="../js/jquery.min.js"></script></head><body> <form acti原创 2021-03-09 14:30:50 · 855 阅读 · 0 评论 -
PHP收藏
PHP保存Base64图片base64_decode的问题https://www.cnblogs.com/binblogs/p/11791379.htmlphp如何将jpg转pnghttps://www.php.cn/php-ask-458661.html原创 2021-03-09 09:07:05 · 67 阅读 · 0 评论 -
PhpPresentation
PHPPresentation说明使用方式有:直接下载文件(本文使用)composer下载git下载文档Welcome to PHPPresentation’s documentation需要下载的文件:PHPPresentationGiteeGitHubCommon使用引入自动加载类require_once '../../PhpOffice/PHPPresentation/src/PhpPresentation/Autoloader.php' ;\ PhpO原创 2021-02-09 08:24:46 · 1580 阅读 · 1 评论 -
php接口 生成 .wsdl文件
步骤:运行creat.php 生成SERVER.wsdl更改生成的.wsdl中<port>部分soap:address的location<port name="..." binding="..." ><soap:address location="http://127.0.0.1/wsdl/creat.php"></port>-><port name="..." binding="..." ><soap:address lo原创 2020-12-05 19:52:05 · 909 阅读 · 0 评论 -
php获取操作系统类型
获取服务器端操作类型常量 PHP_OS: 获取操作系统的名称内置函数php_uname([ string $mode = “a” ] ): 返回运行 PHP 的系统的有关信息mode 是单个字符,用于定义要返回什么信息:‘a’:此为默认。包含序列 “s n r v m” 里的所有模式。‘s’:操作系统名称。例如: FreeBSD。‘n’:主机名。例如: localhost.example.com。‘r’:版本名称,例如: 5.1.2-RELEASE。‘v’:版本信息。操作系统之间有很大.转载 2020-11-06 19:42:58 · 868 阅读 · 0 评论 -
MySQL存储压缩字段
字符串内容太长,text类型已经存不下了字段类型改为blob类型,使用MySQL函数将字符串压缩存储 [BLOB类型的字段用于存储二进制数据]MySQL压缩字符串:字段类型:blob,varbinaryMySQL函数:COMPRESS() 压缩内容UNCOMPRESS() 解压内容uncompressed_length() 查看压缩前的长度length() 字符串长度建表CREATE TABLE `log` ( `LOG` blob) ENGINE=MyISAM DEFAUL原创 2020-11-06 15:00:08 · 1443 阅读 · 0 评论 -
php字符与16进制互转
代码:<?phpfunction str2hex($str){ return bin2hex($str);}function hex2str($hex){ $new = ''; for($i=0;$i<strlen($hex)-1;$i+=2){ $new .= chr(hexdec(substr($hex,$i,2))); } return $new;}$b = 'name=小明&sex=man';$c = str2hex($b);$d = hex2s原创 2020-10-23 10:05:05 · 373 阅读 · 0 评论 -
phpExcel读取
<?phpinclude_once('Classes/PHPExcel.php');/* *$excelPath Excel文件路径 *$sheetNo 第几个sheet *$rows 从第几行开始 *$cols 从第几列开始*/function ReadExc( $excelPath,$sheetNo,$rows,$cols ){ $fileType = PHPExcel_IOFactory::identify($excelPath);//文件名自動判斷文件類型 $r原创 2020-06-26 18:21:06 · 514 阅读 · 0 评论 -
php判断字符串中个数最多的元素及个数
php判断字符串中个数最多的元素及个数<?php//判断一个字符串中个数最多的元素及个数class TestString{ public function judgeString($str) { $max_length = 0; $max_str = ""; while(strlen($str)>0) { $length = strlen($str); $first = substr($str,0,1); $str = str_replace($fi原创 2020-06-26 16:45:28 · 288 阅读 · 0 评论 -
php+jQuery 翻牌式抽奖
参考文章:https://itbyc.com/log/php/2454.html↓ 简单练习,没有实现翻牌效果:用户点击1-9中任意一个,模块内容改变。用户点击的块为抽奖结果(颜色变化)。前端文件<!DOCTYPE HTML><html><head> <title>抽奖</title> <meta charset='utf-8'/> <script src="jquery-1.11.1.min.原创 2020-06-13 15:57:51 · 303 阅读 · 0 评论 -
php获取客户端机器名
<?phpgethostbyaddr($_SERVER['REMOTE_ADDR'])//获取客户机的机器名转载 2020-06-09 14:06:06 · 510 阅读 · 0 评论 -
php获取客户端电脑用户名
php获取电脑用户名<?php/************************************************************************************************************************************************* PHP NTLM GET LOGIN * Version 0.2.1* http://www.secusquad.com/ntlm/转载 2020-06-09 13:51:11 · 1031 阅读 · 0 评论 -
php获取客户端IP地址
<?phpfunction get_real_ipaddress() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) { return $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { return $_SERVER['HTTP_X_FORWARDED_FOR']; } return $原创 2020-06-09 13:33:13 · 138 阅读 · 0 评论 -
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in...
php5.6下soap报错如图:解决办法:把php.ini中的 always_populate_raw_post_data = -1 打开或升级php版本至7wsdl下的俩函数:$client->__getTypes()//Returns an array of types described in the WSDL for the Web service.返回Web服务的WSDL中描述的类型数组。$soap->__getFunctions()//Returns an a转载 2020-06-08 18:34:33 · 458 阅读 · 0 评论 -
php发送邮件
使用 phpmailer發送郵件<?phprequire_once 'mailer/class.phpmailer.php';require_once 'mailer/class/smtp.php';$mail = new PHPMailer();try{ //服務器配置 $mail -> CharSet = 'UTF-8';//设定邮件编码 $m...原创 2020-05-08 16:52:17 · 202 阅读 · 0 评论 -
PHP addslashes() 函数
读取CSV文件,进行数据库插入时,出现特殊字符导致无法正常导入数据addslashes() 函数返回在预定义字符之前添加反斜杠的字符串。预定义字符是:单引号(’)双引号(")反斜杠(\)NULL该函数可用于为存储在数据库中的字符串以及数据库查询语句准备字符串。注释:默认地,PHP 对所有的 GET、POST 和 COOKIE 数据自动运行 addslashes()。所以您不应对已转...原创 2020-04-22 17:31:00 · 257 阅读 · 0 评论 -
正则:去掉多余空格
正则:去掉多余空格代码:<?php echo "去掉多餘空格字符<br/>"; $val = "空格 ;tab ;回車 ,空格+tab ;tab+空格 ;空格+tab+空格 ;兩空格 ;空格+回車 ;輛回車 ;輛tab ;"; var_dump( $val).'<br/>'; $val = preg_replace("/\s(?=\s...原创 2020-03-17 14:45:06 · 337 阅读 · 0 评论 -
php相似度
php相似度比较的方法:使用php函数similar_text(string1,string2,percent)参数描述string1必需。规定要比较的第一个字符串。string2必需。规定要比较的第二个字符串。percent可选。规定供存储百分比相似度的变量名。 class LCS { var $str1; var ...原创 2020-03-05 17:46:16 · 435 阅读 · 0 评论 -
php输出A到AZY的所有字母及组合
代码<?phpfor($i='A';$i!="AZZ";$i++){ echo $i."<br/>";}?>输出A到AZY的所有字母及组合(1377个)原创 2020-03-02 10:37:29 · 509 阅读 · 0 评论