php常用方法
php大白猫
三百字以内
展开
-
php获取汉字首字母方法
function getFirstCharter($str){if(empty($str)){return ‘’;}fchar=ord(fchar=ord(fchar=ord(str{0});if(KaTeX parse error: Expected 'EOF', got '&' at position 16: fchar>=ord('A')&̲&fchar<=ord(‘z’)) return strtoupper($str{0});s1=iconv(′UTF−原创 2021-08-25 14:53:13 · 1762 阅读 · 0 评论 -
php视频流
//视频流代码namespace app\statistics\controller;//当前在Thinkphp5框架中使用,需要使用到命名空间。class VideostreamClass{ private $stream = ''; private $buffer = 102400; private $start = -1; private $end = -1; private $size = 0; function __co原创 2021-08-25 14:40:07 · 351 阅读 · 0 评论 -
TP5.1 cache实现搜索记录,保存最新10条
//入列10个,每次新加的值在第一位。如果有重复把重复的值放到第一位,其他依次往后排//添加历史搜索记录private function search_cache(search,search,search,userid){//获取历史记录searchInfo=cache::get(′search1′.searchInfo=cache::get('search1'.searchInfo=cache::get(′search1′.userid);//判断历史记录是否已经包含if (!empty($s原创 2021-08-25 14:35:14 · 246 阅读 · 0 评论