在 codeigniter 中将当前年份和月份添加到基数 url
Include the current year and month to the base url in codeigniter
我想将当前年份和月份添加到此url,在索引之后调用我的事件日历
<li><a href="<?php echo base_url('index.php/Event/index'); ?>">Events</a></li>
像这样----> index.php/Event/index/year/month
你可以使用 PHP date()
,
<?php
$suffix = date("Y/m");
?>
<li><a href="<?php echo base_url("index.php/Event/index/$suffix"); ?>">Events</a></li>
这将产生类似于,
<li><a href="https://www.example.com/index.php/Event/index/2021/05">Events</a></li>
了解 PHP date()
我想将当前年份和月份添加到此url,在索引之后调用我的事件日历
<li><a href="<?php echo base_url('index.php/Event/index'); ?>">Events</a></li>
像这样----> index.php/Event/index/year/month
你可以使用 PHP date()
,
<?php
$suffix = date("Y/m");
?>
<li><a href="<?php echo base_url("index.php/Event/index/$suffix"); ?>">Events</a></li>
这将产生类似于,
<li><a href="https://www.example.com/index.php/Event/index/2021/05">Events</a></li>
了解 PHP date()