使用官方Model Context Protocol PHP SDK将PHP应用程序功能暴露为MCP工具、资源和提示,用于代理工作流。
1. [文件] php月历类
<meta><script></script><script>
<!--
$(function (){
$(".subMenu").hide()
$(".menu>td>a").mouseover(function () {
$(".subMenu").stop(true,true).hide(0);
$(this).parent().find("div.subMenu").slideDown("slow");
$(this).parent().addClass("mainHover")
})
$(".menu>td").hover(function () {},function () {$(this).find("div.subMenu").hide();
$(this).removeClass("mainHover")
}
)
})
-->
</script><style>
<!--
#Layer1 {
position:absolute;
z-index:1;
display:none;
width:100px;
height:100px;
background: #ccc;
border:1px solid #ccc;
padding: 10px;
font-size: 14px;
color: red;
font-weight: bold;
}
a{
display: block;
width: 50px;
height: 100%;
text-decoration: none;
}
a:hover{
text-decoration:underline;
}
-->
</style><?php
class calendar{
private $_BiaoJi=1;
private $_CurrMon;//当前月
private $_MonNum;//每月天数
private $_WeekNum;//星期
private $_url;//连接;
private $_FirstDay;//每月的第一天
private $_LastDay;//每月的最后一天
private $_MonWeekSum;//每月有几个周
//构造方法赋值
function __construct() {
$this->_CurrMon= isset($_GET['mon'])?$_GET['mon']: date('n');
$this->_MonNum=array(31,30,31,30,31,30,31,31,30,31,30,31);
$this->_WeekNum=array('日','一','二','三','四','五','六');
$this->_url= $this->GetUrl();
$this->_FirstDay= getdate(mktime(0,0,0, $this->_CurrMon,1, date('Y')));
$this->Two();
$this->_LastDay= $this->_MonNum[$this->_CurrMon-1];
$this->_MonWeekSum= $this->MonWeekSum();
}
//返回连接
private function GetUrl(){
$_url=$_SERVER['REQUEST_URI'];
$_arr= parse_url($_url);
parse_str($_arr['query'],$_QueryArr);
unset($_QueryArr['mon']);
$_str= http_build_query($_QueryArr);
return $_arr['path'].'?'.$_str.'&mon=';
}
//返回二月份天数
private function Two(){
if(date('L')){
return $this->_MonNum[1]=29;
}else{
return $this->_MonNum[1]=28;
}
}
//返回每月的星期数
private function MonWeekSum(){
return ceil(($this->_LastDay+$this->_FirstDay['wday'])/7);
}
//上月
private function PreMon(){
if($this->_CurrMon>1){
return "<a>_url.($this->_CurrMon-1)."' style='float:left; margin-left:15%;'>";
}
}
private function NextMon(){
if($this->_CurrMon_url.($this->_CurrMon+1)."' style='float:right; margin-right:15%;'>>></a>";
}
}
//月历
private function Mon(){
echo "
| ".$this->PreMon().' '.date("Y").' 年 '.$this->_CurrMon.' 月 月历 '.$this->NextMon()." | ||
| {$_arr1} | "; } echo "||
|   | "; $this->_FirstDay['wday']--; }else{ if($this->_BiaoJi==date('j')){ echo "
{$this->_BiaoJi} 阳历".$this->_CurrMon."月".$this->_BiaoJi."号"."
| ";
}else{
echo "
{$this->_BiaoJi} 阳历".$this->_CurrMon."月".$this->_BiaoJi."号"."
| ";
}
$this->_BiaoJi++;
}
}
echo "
2. [文件] php月历类 ~ 70KB
php免费学习视频:立即使用
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!










