两款万能的php分页类,两款php分页
两款万能的php分页类,两款php分页
本文为大家分享个超级好用、万能的php分页类,具体的实现代码如下
第一款php分页类
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * 分页类 * 使用方式: * $page = new Page(); * $page->init(1000, 20); * $page->setNotActiveTemplate('<span> {a} </span>'); * $page->setActiveTemplate('{a}'); * echo $page->show(); * * * @author 风居住的地方 */ class Page { /** * 总条数 */ private $total; /** * 每页大小 */ private $pageSize; /** * 总页数 */ private $pageNum; /** * 当前页 */ private $page; /** * 地址 */ private $uri; /** * 分页变量 */ private $pageParam; /** * LIMIT XX,XX */ private $limit; /** * 数字分页显示 */ private $listnum = 8; /** * 分页显示模板 * 可用变量参数 * {total} 总数据条数 * {pagesize} 每页显示条数 * {start} 本页开始条数 * {end} 本页结束条数 * {pagenum} 共有多少页 * {frist} 首页 * {pre} 上一页 * {next} 下一页 * {last} 尾页 * {list} 数字分页 * {goto} 跳转按钮 */ private $template = '<div><span>共有{total}条数据</span><span>每页显示{pagesize}条数据</span>,<span>本页{start}-{end}条数据</span><span>共有{pagenum}页</span><ul>{frist}{pre}{list}{next}{last}{goto}</ul></div>'; /** * 当前选中的分页链接模板 */ private $activeTemplate = '<li class="active"><a href="javascript:;">{text}</a></li>'; /** * 未选中的分页链接模板 */ private $notActiveTemplate = '<li><a href="{url}">{text}</a></li>'; /** * 显示文本设置 */ private $config = array('frist' => '首页', 'pre' => '上一页', 'next' => '下一页', 'last' => '尾页'); /** * 初始化 * @param type $total 总条数 * @param type $pageSize 每页大小 * @param type $param url附加参数 * @param type $pageParam 分页变量 */ public function init($total, $pageSize, $param = '', $pageParam = 'page') { $this->total = intval($total); $this->pageSize = intval($pageSize); $this->pageParam = $pageParam; $this->uri = $this->geturi($param); $this->pageNum = ceil($this->total / $this->pageSize); $this->page = $this->setPage(); $this->limit = $this->setlimit(); } /** * 设置分页模板 * @param type $template 模板配置 */ public function setTemplate($template) { $this->template = $template; } /** * 设置选中分页模板 * @param type $activeTemplate 模板配置 */ public function setActiveTemplate($activeTemplate) { $this->activeTemplate = $activeTemplate; } /** * 设置未选中分页模板 * @param type $notActiveTemplate 模板配置 */ public function setNotActiveTemplate($notActiveTemplate) { $this->notActiveTemplate = $notActiveTemplate; } /** * 返回分页 * @return type */ public function show() { return str_ireplace(array( '{total}', '{pagesize}', '{start}', '{end}', '{pagenum}', '{frist}', '{pre}', '{next}', '{last}', '{list}', '{goto}', ), array( $this->total, $this->setPageSize(), $this->star(), $this->end(), $this->pageNum, $this->frist(), $this->prev(), $this->next(), $this->last(), $this->pagelist(), $this->gopage(), ), $this->template); } /** * 获取limit起始数 * @return type */ public function getOffset() { return ($this->page - 1) * $this->pageSize; } /** * 设置LIMIT * @return type */ private function setlimit() { return "limit " . ($this->page - 1) * $this->pageSize . ",{$this->pageSize}"; } /** * 获取limit * @param type $args * @return type */ public function __get($args) { if ($args == "limit") { return $this->limit; } else { return null; } } /** * 初始化当前页 * @return int */ private function setPage() { if (!empty($_GET[$this->pageParam])) { if ($_GET[$this->pageParam] > 0) { if ($_GET[$this->pageParam] > $this->pageNum) return $this->pageNum; else return $_GET[$this->pageParam]; } } return 1; } /** * 初始化url * @param type $param * @return string */ private function geturi($param) { $url = $_SERVER['REQUEST_URI'] . (strpos($_SERVER['REQUEST_URI'], "?") ? "" : "?") . $param; $parse = parse_url($url); if (isset($parse["query"])) { parse_str($parse["query"], $params); unset($params["page"]); $url = $parse["path"] . "?" . http_build_query($params); return $url; } else { return $url; } } /** * 本页开始条数 * @return int */ private function star() { if ($this->total == 0) { return 0; } else { return ($this->page - 1) * $this->pageSize + 1; } } /** * 本页结束条数 * @return type */ private function end() { return min($this->page * $this->pageSize, $this->total); } /** * 设置当前页大小 * @return type */ private function setPageSize() { return $this->end() - $this->star() + 1; } /** * 首页 * @return type */ private function frist() { $html = ''; if ($this->page == 1) { $html .= $this->replace("{$this->uri}&page=1", $this->config['frist'], true); } else { $html .= $this->replace("{$this->uri}&page=1", $this->config['frist'], false); } return $html; } /** * 上一页 * @return type */ private function prev() { $html = ''; if ($this->page > 1) { $html .= $this->replace($this->uri.'&page='.($this->page - 1), $this->config['pre'], false); } else { $html .= $this->replace($this->uri.'&page='.($this->page - 1), $this->config['pre'], true); } return $html; } /** * 分页数字列表 * @return type */ private function pagelist() { $linkpage = ""; $lastlist = floor($this->listnum / 2); for ($i = $lastlist; $i >= 1; $i--) { $page = $this->page - $i; if ($page >= 1) { $linkpage .= $this->replace("{$this->uri}&page={$page}", $page, false); } else { continue; } } $linkpage .= $this->replace("{$this->uri}&page={$this->page}", $this->page, true); for ($i = 1; $i <= $lastlist; $i++) { $page = $this->page + $i; if ($page <= $this->pageNum) { $linkpage .= $this->replace("{$this->uri}&page={$page}", $page, false); } else { break; } } return $linkpage; } /** * 下一页 * @return type */ private function next() { $html = ''; if ($this->page < $this->pageNum) { $html .= $this->replace($this->uri.'&page='.($this->page + 1), $this->config['next'], false); } else { $html .= $this->replace($this->uri.'&page='.($this->page + 1), $this->config['next'], true); } return $html; } /** * 最后一页 * @return type */ private function last() { $html = ''; if ($this->page == $this->pageNum) { $html .= $this->replace($this->uri.'&page='.($this->pageNum), $this->config['last'], true); } else { $html .= $this->replace($this->uri.'&page='.($this->pageNum), $this->config['last'], false); } return $html; } /** * 跳转按钮 * @return string */ private function gopage() { $html = ''; $html.=' <input type="text" value="' . $this->page . '" onkeydown="javascript:if(event.keyCode==13){var page=(this.value>' . $this->pageNum . ')?' . $this->pageNum . ':this.value;location=\'' . $this->uri . '&page=\'+page+\'\'}" style="width:25px;"/><input type="button" onclick="javascript:var page=(this.previousSibling.value>' . $this->pageNum . ')?' . $this->pageNum . ':this.previousSibling.value;location=\'' . $this->uri . '&page=\'+page+\'\'" value="GO"/>'; return $html; } /** * 模板替换 * @param type $replace 替换内容 * @param type $result 条件 * @return type */ private function replace($url, $text, $result = true) { $template = ($result ? $this->activeTemplate : $this->notActiveTemplate); $html = str_replace('{url}', $url, $template); $html = str_replace('{text}', $text, $html); return $html; } }
第二款php分页类
<?php /* *本程序文件对分页程序进行了封装 * */ class Page_Link { var $page_max = 10; //一组页码的最大数 var $page_num = 10; //总页数 var $length = 20; //一页的数据条数 var $isNextPage = true; var $isFirstPage = false; function Calculation_Page_Num( $total ) { $this->page_num = ceil( $total / $this->length ); return $this->page_num; } function Calculation_Min_Max( $act_page = 1 ) { // 定义左右偏移量 $py_left = 0; $py_right = 0; // 定义左右边界 $bj_left = 0; $bj_right = 0; // 定义滚动区间边界 $gd_left = 0; $gd_right = 0; // 判断是否需要分组 if ( ( $this->page_num - $this->page_max ) <= 0 ) { // 不需要分组 $bj_left = 1; $bj_right = $this->page_num; } else { // 要进行分组 // 判断容量的奇偶 $tmp = $this->page_max % 2; if ( $tmp === 1 ) { // 奇数 $py_left = $py_right = ( $this->page_max - 1 ) / 2; } else { // 偶数 $py_left = $this->page_max / 2 - 1; $py_right = $this->page_max / 2; } // 计算滚动区间 $gd_left = 1 + $py_left; $gd_right = $this->page_num - $py_right; // 判断当前页是否落入了滚动区间 if ( $act_page >= $gd_left && $act_page <= $gd_right ) { // 区间内 $bj_left = $act_page - $py_left; $bj_right = $act_page + $py_right; } else { // 区间外 if ( ( $act_page - $py_left ) <= 1 ) { // 左侧固定区间 $bj_left = 1; $bj_right = $this->page_max; } else { $bj_left = $this->page_num - $this->page_max + 1; $bj_right = $this->page_num; } } } $res = array(); $res['min'] = $bj_left; $res['max'] = $bj_right; return $res; } // 主方法 function make_page( $total, $act_page, $url, $param ) { $page_num = $this->Calculation_Page_Num( $total ); $arr_min_max = $this->Calculation_Min_Max( $act_page ); if (!eregi("([?|&]$param=)", $url)) { $url = strpos($url,"?")===false?$url."?":$url."&"; $url = $url."$param=0"; } if ( $act_page > $page_num ) { $act_page = $page_num; } // 用正则把url改成正规的 $url = eregi_replace( $param . '=[0-9]+', $param . '=0', $url ); $res = array(); $d = 0; for( $i = $arr_min_max['min'];$i <= $arr_min_max['max'];$i++ ) { if ( $i == $act_page ) { $res[$d]['url'] = ''; $res[$d]['name'] = $i; $res[$d]['no'] = $i; } else { $res[$d]['url'] = str_replace( $param . '=0', $param . '=' . $i, $url ); $res[$d]['name'] = $i; $res[$d]['no'] = $i; } $d++; } if ( $this->isNextPage ) { $res = $this->make_before_next_link( $res, $act_page, $url, $param ); } if ( $this->isFirstPage ) { $res = $this->make_first_end_link( $res, $act_page, $url, $param ); } return $res; } //// 带总页数 function make_page_with_total( $total, $act_page, $url, $param ) { $page_num = $this->Calculation_Page_Num( $total ); $arr_min_max = $this->Calculation_Min_Max( $act_page ); if (!eregi("([?|&]$param=)", $url)) { $url = strpos($url,"?")===false?$url."?":$url."&"; $url = $url."$param=0"; } if ( $act_page > $page_num ) { $act_page = $page_num; } // 用正则把url改成正规的 $url = eregi_replace( $param . '=[0-9]+', $param . '=0', $url ); $res = array(); $d = 0; for( $i = $arr_min_max['min'];$i <= $arr_min_max['max'];$i++ ) { if ( $i == $act_page ) { $res[$d]['url'] = ''; $res[$d]['name'] = $i; $res[$d]['no'] = $i; } else { $res[$d]['url'] = str_replace( $param . '=0', $param . '=' . $i, $url ); $res[$d]['name'] = $i; $res[$d]['no'] = $i; } $d++; } if ( $this->isNextPage ) { $res = $this->make_before_next_link( $res, $act_page, $url, $param ); } if ( $this->isFirstPage ) { $res = $this->make_first_end_link( $res, $act_page, $url, $param ); } $total_num= ceil($total/$this->length); $result['total']=$total_num; $result['DATA']=$res; return $result; } // 附加上一页和下一页 function make_before_next_link( $arr, $act, $url, $param ) { $tmp = array(); $before = $act - 1; $next = $act + 1; if ( $before < 1 ) { $before = 1; $tmp[0]['url'] = ''; $tmp[0]['name'] = "上一页"; $tmp[0]['no'] = $before; } else { $tmp[0]['url'] = str_replace( $param . '=0', $param . '=' . $before, $url ); $tmp[0]['name'] = "上一页"; $tmp[0]['no'] = $before; } $counts = sizeof( $arr ); $tmp_count = sizeof( $tmp ); for( $i = 0;$i < $counts;$i++ ) { $tmp[$tmp_count]['url'] = $arr[$i]['url']; $tmp[$tmp_count]['name'] = $arr[$i]['name']; $tmp[$tmp_count]['no'] = $arr[$i]['no']; $tmp_count++; } if ( $next > $this->page_num ) { $next = $this->page_num; $tmp[$tmp_count]['url'] = ''; $tmp[$tmp_count]['name'] = "下一页"; $tmp[$tmp_count]['no'] = $next; } else { $tmp[$tmp_count]['url'] = str_replace( $param . '=0', $param . '=' . $next, $url ); $tmp[$tmp_count]['name'] = "下一页"; $tmp[$tmp_count]['no'] = $next; } return $tmp; } // 附加首页和尾页 function make_first_end_link( $arr, $act, $url, $param ) { $tmp = array(); $before = 1; $next = $this->page_num; if ( $act == 1 ) { $before = 1; $tmp[0]['url'] = ''; $tmp[0]['name'] = "首页"; $tmp[0]['no'] = $before; } else { $tmp[0]['url'] = str_replace( $param . '=0', $param . '=' . $before, $url ); $tmp[0]['name'] = "首页"; $tmp[0]['no'] = $before; } $counts = sizeof( $arr ); $tmp_count = sizeof( $tmp ); for( $i = 0;$i < $counts;$i++ ) { $tmp[$tmp_count]['url'] = $arr[$i]['url']; $tmp[$tmp_count]['name'] = $arr[$i]['name']; $tmp[$tmp_count]['no'] = $arr[$i]['no']; $tmp_count++; } if ( $act == $this->page_num ) { $tmp[$tmp_count]['url'] = ''; $tmp[$tmp_count]['name'] = "尾页"; $tmp[$tmp_count]['no'] = $next; } else { $tmp[$tmp_count]['url'] = str_replace( $param . '=0', $param . '=' . $next, $url ); $tmp[$tmp_count]['name'] = "尾页"; $tmp[$tmp_count]['no'] = $next; } return $tmp; } /** * 带上一页<,下一页>,省略号的分页 * @param int $total 记录总条数 * @param int $act_page 当前页码 * @param string $url url * @param int $maxpageicon 最大显示页码数 * @param int $style 上一页,下一页显示样式 * @param string $param url参数 */ function make_page_with_points( $total,$act_page,$url,$maxpageicon,$style,$param ) { $page_num = $this->Calculation_Page_Num( $total ); //总页数 $arr_min_max = $this->Calculation_Min_Max( $act_page ); //最大页,最小页 if($total==0) { return ""; } if( $act_page > $page_num ) { $act_page = $page_num+1; $page_num = $page_num+1; } switch ($style){ case 1: $name_before = '前一页'; $name_next = '后一页'; break; case 2: $name_before = '<'; $name_next = '>'; break; case 3: $name_before = '<<'; $name_next = '>>'; break; default: $name_before = '上一页'; $name_next = '下一页'; } if (!eregi("([?|&]$param=)", $url)) { $url = strpos($url,"?")===false?$url."?":$url."&"; $url = $url."$param=0"; } // 用正则把url改成正规的 $url = eregi_replace( $param . '=[0-9]+', $param . '=0', $url ); $res = array(); $no_before = $act_page-1; $no_next = $act_page+1; //总页数如果小于等于初始化最大呈现页数 if ($page_num<= ($maxpageicon + 1)) { //如果当前页数是首页 上一页无效 if ($act_page == 1) { $res[0]['url'] = ''; $res[0]['name'] = $name_before; $res[0]['no'] = $no_before; } else //上一页有效 { $res[0]['url'] = str_replace( $param . '=0', $param . '=' .($act_page - 1), $url ); $res[0]['name'] = $name_before; $res[0]['no'] = $no_before; } //循环添加页码 $d = 1; for ($i = 1; $i <= $page_num; $i++) { if ($i != $act_page) { $res[$d]['url'] = str_replace( $param . '=0', $param . '=' . $i, $url ); $res[$d]['name'] = $i; $res[$d]['no'] = $i; } else //当前页,页码 { $res[$d]['url'] = ''; $res[$d]['name'] = $i; $res[$d]['no'] = $i; $res[$d]['attr'] = 'current'; } $d++; } $last_d = count($res); //判断尾页 if($act_page == $page_num) //下一页无效 { $res[$last_d]['url'] = ''; $res[$last_d]['name'] = $name_next; $res[$last_d]['no'] = $no_next; } else { $res[$last_d]['url'] = str_replace( $param . '=0', $param . '=' .($act_page + 1), $url ); $res[$last_d]['name'] = $name_next; $res[$last_d]['no'] = $no_next; } }else if ($page_num > ($maxpageicon + 1))//如果总页数满足添加省略号 { if ($act_page <= $maxpageicon) //如果当前页小于等于初始化数目 { //如果当前页数是首页 上一页无效 if ($act_page == 1) { $res[0]['url'] = ''; $res[0]['name'] = $name_before; $res[0]['no'] = $no_before; } else //上一页有效 { $res[0]['url'] = str_replace( $param . '=0', $param . '=' .($act_page - 1), $url ); $res[0]['name'] = $name_before; $res[0]['no'] = $no_before; } //循环添加页码 $d = 1; for ($i = 1; $i <= $maxpageicon; $i++) { if ($i != $act_page) { $res[$d]['url'] = str_replace( $param . '=0', $param . '=' . $i, $url ); $res[$d]['name'] = $i; $res[$d]['no'] = $i; } else //当前页,页码 { $res[$d]['url'] = ''; $res[$d]['name'] = $i; $res[$d]['no'] = $i; $res[$d]['attr'] = 'current'; } $d++; } $last_d = count($res); //添加省略号 $res[$last_d]['url'] = ''; $res[$last_d]['name'] = '...'; $res[$last_d]['no'] = ''; //总页数 $res[$last_d+1]['url'] = str_replace( $param . '=0', $param . '=' . $page_num, $url ); $res[$last_d+1]['name'] = $page_num; $res[$last_d+1]['no'] = $page_num; //下一页 $res[$last_d+1]['url'] = str_replace( $param . '=0', $param . '=' . ($act_page + 1), $url ); $res[$last_d+1]['name'] = $name_next; $res[$last_d+1]['no'] = $no_next; }else//如果当前页大于最大显示页面 { if ($act_page > ($page_num - $maxpageicon))//满足后几页 { //上一页 $res[0]['url'] = str_replace( $param . '=0', $param . '=' .($act_page - 1), $url ); $res[0]['name'] = $name_before; $res[0]['no'] = $no_before; //第一页 $res[1]['url'] = str_replace( $param . '=0', $param . '=1', $url ); $res[1]['name'] = 1; $res[1]['no'] = 1; //省略号 $res[2]['url'] = ''; $res[2]['name'] = '...'; $res[2]['no'] = ''; $d = 3; for ($i = ($page_num - $maxpageicon + 1); $i <= $page_num; $i++) { if ($i != $act_page) { $res[$d]['url'] = str_replace( $param . '=0', $param . '=' . $i, $url ); $res[$d]['name'] = $i; $res[$d]['no'] = $i; } else //当前页,页码 { $res[$d]['url'] = ''; $res[$d]['name'] = $i; $res[$d]['no'] = $i; $res[$d]['attr'] = 'current'; } $d++; } $last_d = count($res); //判断尾页 if($act_page == $page_num) //下一页无效 { $res[$last_d]['url'] = ''; $res[$last_d]['name'] = $name_next; $res[$last_d]['no'] = $no_next; } else { $res[$last_d]['url'] = str_replace( $param . '=0', $param . '=' .($act_page + 1), $url ); $res[$last_d]['name'] = $name_next; $res[$last_d]['no'] = $no_next; } }else//满足处在中间 { //上一页 $res[0]['url'] = str_replace( $param . '=0', $param . '=' .($act_page - 1), $url ); $res[0]['name'] = $name_before; $res[0]['no'] = $no_before; //第一页 $res[1]['url'] = str_replace( $param . '=0', $param . '=1', $url ); $res[1]['name'] = 1; $res[1]['no'] = 1; //省略号 $res[2]['url'] = ''; $res[2]['name'] = '...'; $res[2]['no'] = ''; for ($i = ($act_page - ($maxpageicon - 2) / 2); $i <= floor($act_page+($maxpageicon - 2) / 2); $i++) { $i = ceil($i); if ($i != $act_page) { $res[$d]['url'] = str_replace( $param . '=0', $param . '=' . $i, $url ); $res[$d]['name'] = $i; $res[$d]['no'] = $i; } else //当前页,页码 { $res[$d]['url'] = ''; $res[$d]['name'] = $i; $res[$d]['no'] = $i; $res[$d]['attr'] = 'current'; } $d++; } $last_d = count($res); //加省略号 $res[$last_d]['url'] = ''; $res[$last_d]['name'] = '...'; $res[$last_d]['no'] = ''; //当前页 $res[$last_d+1]['url'] = str_replace( $param . '=0', $param . '=' . $page_num, $url ); $res[$last_d+1]['name'] = $page_num; $res[$last_d+1]['no'] = $page_num; //下一页 $res[$last_d+2]['url'] = str_replace( $param . '=0', $param . '=' . ($act_page + 1), $url ); $res[$last_d+2]['name'] = $name_next; $res[$last_d+2]['no'] = $no_next; //exit; } } } return $res; } } ?>
以上就是为大家分享的两款php分页类,希望对大家的学习有所帮助。

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











PHP 8.4는 상당한 양의 기능 중단 및 제거를 통해 몇 가지 새로운 기능, 보안 개선 및 성능 개선을 제공합니다. 이 가이드에서는 Ubuntu, Debian 또는 해당 파생 제품에서 PHP 8.4를 설치하거나 PHP 8.4로 업그레이드하는 방법을 설명합니다.

VS Code라고도 알려진 Visual Studio Code는 모든 주요 운영 체제에서 사용할 수 있는 무료 소스 코드 편집기 또는 통합 개발 환경(IDE)입니다. 다양한 프로그래밍 언어에 대한 대규모 확장 모음을 통해 VS Code는

숙련된 PHP 개발자라면 이미 그런 일을 해왔다는 느낌을 받을 것입니다. 귀하는 상당한 수의 애플리케이션을 개발하고, 수백만 줄의 코드를 디버깅하고, 여러 스크립트를 수정하여 작업을 수행했습니다.

이 튜토리얼은 PHP를 사용하여 XML 문서를 효율적으로 처리하는 방법을 보여줍니다. XML (Extensible Markup Language)은 인간의 가독성과 기계 구문 분석을 위해 설계된 다목적 텍스트 기반 마크 업 언어입니다. 일반적으로 데이터 저장 AN에 사용됩니다

JWT는 주로 신분증 인증 및 정보 교환을 위해 당사자간에 정보를 안전하게 전송하는 데 사용되는 JSON을 기반으로 한 개방형 표준입니다. 1. JWT는 헤더, 페이로드 및 서명의 세 부분으로 구성됩니다. 2. JWT의 작업 원칙에는 세 가지 단계가 포함됩니다. JWT 생성, JWT 확인 및 Parsing Payload. 3. PHP에서 인증에 JWT를 사용하면 JWT를 생성하고 확인할 수 있으며 사용자 역할 및 권한 정보가 고급 사용에 포함될 수 있습니다. 4. 일반적인 오류에는 서명 검증 실패, 토큰 만료 및 대형 페이로드가 포함됩니다. 디버깅 기술에는 디버깅 도구 및 로깅 사용이 포함됩니다. 5. 성능 최적화 및 모범 사례에는 적절한 시그니처 알고리즘 사용, 타당성 기간 설정 합리적,

문자열은 문자, 숫자 및 기호를 포함하여 일련의 문자입니다. 이 튜토리얼은 다른 방법을 사용하여 PHP의 주어진 문자열의 모음 수를 계산하는 방법을 배웁니다. 영어의 모음은 A, E, I, O, U이며 대문자 또는 소문자 일 수 있습니다. 모음이란 무엇입니까? 모음은 특정 발음을 나타내는 알파벳 문자입니다. 대문자와 소문자를 포함하여 영어에는 5 개의 모음이 있습니다. a, e, i, o, u 예 1 입력 : String = "Tutorialspoint" 출력 : 6 설명하다 문자열의 "Tutorialspoint"의 모음은 u, o, i, a, o, i입니다. 총 6 개의 위안이 있습니다

정적 바인딩 (정적 : :)는 PHP에서 늦은 정적 바인딩 (LSB)을 구현하여 클래스를 정의하는 대신 정적 컨텍스트에서 호출 클래스를 참조 할 수 있습니다. 1) 구문 분석 프로세스는 런타임에 수행됩니다. 2) 상속 관계에서 통화 클래스를 찾아보십시오. 3) 성능 오버 헤드를 가져올 수 있습니다.

PHP의 마법 방법은 무엇입니까? PHP의 마법 방법은 다음과 같습니다. 1. \ _ \ _ Construct, 객체를 초기화하는 데 사용됩니다. 2. \ _ \ _ 파괴, 자원을 정리하는 데 사용됩니다. 3. \ _ \ _ 호출, 존재하지 않는 메소드 호출을 처리하십시오. 4. \ _ \ _ get, 동적 속성 액세스를 구현하십시오. 5. \ _ \ _ Set, 동적 속성 설정을 구현하십시오. 이러한 방법은 특정 상황에서 자동으로 호출되어 코드 유연성과 효율성을 향상시킵니다.
