我们在开发项目过程中,网站所需要一些日期的输入,如至今的年月日,下面就是我给大家整理的一些日常用到的一些获取日期时间的数组。
获取从一开始至今的年份
我们在开发项目过程中,网站所需要一些日期的输入,如至今的年月日,下面就是我给大家整理的一些日常用到的一些获取日期时间的数组。
获取从一开始至今的年份
function yearArray(){
$tody = getdate();
$todyYear = $tody['year'];
$startYear = 1900-1;
$i = 1;
for($startYear; $startYear <p> </p><p></p><div class="aritcle_card flexRow artxards">
<div class="artcardd flexRow">
<a class="aritcle_card_img" rel="nofollow" href="/xiazai/skill13222" title="Build MCP servers and clients for PHP applications with the official PHP SDK"><img
src="https://img.php.cn/upload/skill/001/246/273/6adaf20e352aa140.jpg" alt="Build MCP servers and clients for PHP applications with the official PHP SDK" onerror="this.onerror='';this.src='/static/lhimages/moren/morentu.png'" ></a>
<div class="aritcle_card_info flexColumn">
<a rel="nofollow" href="/xiazai/skill13222" title="Build MCP servers and clients for PHP applications with the official PHP SDK" class="overflowclass">Build MCP servers and clients for PHP applications with the official PHP SDK</a>
<p class="overflowclass">使用官方Model Context Protocol PHP SDK将PHP应用程序功能暴露为MCP工具、资源和提示,用于代理工作流。</p>
</div>
<a rel="nofollow" href="/xiazai/skill13222" title="Build MCP servers and clients for PHP applications with the official PHP SDK" class="aritcle_card_btn flexRow flexcenter"><b></b><span>下载</span>
</a>
</div>
</div><p><br></p><p>获取12个月份的数组</p><pre class="brush:php;toolbar:false">function monthArray(){
$monthArr = array(1,2,3,4,5,6,7,8,9,10,11,12);
return $monthArr;
}
获取某个月份所有日的数组
function dayArray(){
$dayArr = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31);
return $dayArr;
}
获取周一到周日的数组
function weekArr(){
return array('1'=>'星期一','2'=>'星期二','3'=>'星期三','4'=>'星期四','5'=>'星期五','6'=>'星期六','7'=>'星期日');
php免费学习视频:立即使用
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!










