我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

在非对象上调用成员函数format()

In codeigniter, I have written the following line of code under my methods in the controller:

            $dt = new DateTime();

In my views page, I've created an h1 tag and placed the following in it:

<h1><?php $dt->format('M, d Y'); ?></h1>

But I get the following error:

enter image description here

I would appreciate if anyone can explain this to me in detail.

近期文章

  • 如何使用php web服务在mysql数据库中获取数据
  • 从表单选项中获取ID并使用它来填充多个字段
  • 仅针对背景图像的CSS3过渡
  • 在javascript中解密PHP aes加密
  • 在页面加载和页面刷新之间获得时间 - 我有负面时间?
  • 调试Laravel Mail :: send()
  • 让wampserver工作?
  • 为什么cookie值错了?
  • 这是否打破了封闭原则
  • Cakephp自定义验证输入
  • 如何检查套接字是否存活
  • JOIN表MySQL没有加入PHP
  • 交替的行颜色我错过了什么
  • https连接传递另一台服务器
  • Chrome扩展程序,通过php将大变量传递到其他Windows
  • 致命错误:允许内存耗尽(wordpress +插件)CSV导入
  • 当一个数组中的字符串与第二个数组中的字符串不同时获取字符串值
  • 将条形进度条引入上传文件
  • JQuery和Bootstrap 3简单易用
  • OOP PHP类可变范围

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华