草庐IT

libboost_date_time

全部标签

php - <b> fatal error </b> : Uncaught exception 'Exception' with message 'Failed to connect to api.twitter.com port 443: Connection timed out'

我正在开发一个Codeigniter项目,在该项目中我使用twitterapi库来获取twitter数据。在我更改服务器之前它工作得很好,但是在更改服务器之后它产生了以下错误。我不知道问题所在。Fatalerror:Uncaughtexception'Exception'withmessage'Failedtoconnecttoapi.twitter.comport443:Connectiontimedout'in/my/project/path/myProject/application/ws/libraries/TwitterAPIExchange.php:297Stacktrac

php - PHP date_create() 上的 Twig 异常

我想根据她的生日计算一个选民的年龄,在我的实体中,我创建了一个这样的函数//voters.phppublicfunctiongetAge(){$birthday=$this->birthday;$age=date_diff(date_create($birthday),date_create('today'))->y;return$age;}我像这样在Twig中渲染它{{entity.getAge()}}但是显示如下错误:"Anexceptionhasbeenthrownduringtherenderingofatemplate("Warning:date_create()expect

php - PHP函数date()的反义词是什么?

PHP中是否有任何函数可以获取日期并将其转换为时间戳,或者可以简单地获取一种格式的日期并将其更改为另一种格式?我有一组格式为“md”的日期,我想将其更改为“l,Fd,Y”。我还需要它和其他格式的日期,所以我需要一个函数,让我给它一个日期、输入格式和输出格式。 最佳答案 试试strtotime(http://www.php.net/strtotime) 关于php-PHP函数date()的反义词是什么?,我们在StackOverflow上找到一个类似的问题: h

php - 在 PHP 和 javascript 中使用 time() 和 setTime() 函数

我想要一个javascript日期对象,其时间根据网络服务器设置。vardate=newDate();date.setTime();alert(date.toString());//displaysthedateandtimeaccordingtothetimezonesetontheclient'scomputer上面的代码靠谱吗?非常感谢大家。 最佳答案 我认为不是。自Javascript'ssetTime()使用毫秒和PHP'stime()使用秒。您需要添加一些东西才能使其正常工作;)我会让您知道是什么。

PHP date_sun_info 错误时间

我正在尝试使用PHP的date_sun_info函数来获取有关全天太阳某些位置的时间的信息:目前我正在使用类似于documentation中的代码.$sun_info=date_sun_info(strtotime('today'),40.42,74.0);foreach($sun_infoas$key=>$val){echo"$key:".date("H:i:s",$val)."";}输出是:sunrise:20:50:20sunset:07:45:03transit:02:17:41civil_twilight_begin:20:22:45civil_twilight_end:08

php - 默认 date() 应该提前 3 个月

我的服务器有很多应用程序实例。我遇到了一个问题,我的一个应用程序实例需要用future的日期进行测试。即我想测试2013年运行的应用程序。如果我更改系统日期,那么它将正常工作,但其他实例也会受到影响。我只想要一个实例的future日期,其余的应该按原样工作。即如果我使用date('Y-m-d');它应该跳转3个月并显示future的日期。而且我不想将秒数添加到默认日期,因为这可能是我的应用程序中的一个巨大变化。 最佳答案 这就是您以可测试的方式编写应用程序的原因。不好:functiondoSomething(){$date=date

php - 有人能解释一下 date ("YW", strtotime ("2016-01-02"));返回 “201653” ?

date("YW",strtotime("2016-01-02"));returns“201653”年还可以周是从2015年开始的 最佳答案 PHP是ISO-8601符合日期:Thepurposeofthisstandardistoprovideanunambiguousandwell-definedmethodofrepresentingdatesandtimes,soastoavoidmisinterpretationofnumericrepresentationsofdatesandtimes,particularlywhen

php - 拉维尔 5.2 :How to display time like this?

我正在使用Laravel5.2,我想这样显示文章的创建时间:created_atdisplayingin1daytoday2-10days(2-10)daysago>10daysshowcreationdatedirectly怎么做?提前致谢!编辑:Controller:publicfunctionshow($id){$article=Article::findOrFail($id);returnview('show',compact('article'));}查看:{{$article->title}}{{$article->content}}{{$article->created_

php - "Maximum execution time of 60 seconds is exceeded"当我重写 toArray() 函数时

我需要覆盖函数toArray()来检查用户是否有适当的权限来获取特定的列,所以我创建了这个函数:publicfunctiontoArray($options=0){if(!auth()->user()->hasPermissionTo('users.show.email')){$this->hidden[]='email';}//etc...returnparent::toJson($options);}但是当我在Controller中使用User::Get()来获取所有用户的列表时,我没有得到任何结果,但是60秒后我得到:[2019-04-0623:18:33]local.ERROR

php - 如何从 Facebook API 读取 birthday_date

我一直在追这个!而且应该这么简单!!我在FaceBook中有一个运行良好的应用程序。但是,我需要获取用户的出生日期。我已成功获得扩展权限请求,但无法将birthday_date取出并放入数据库中的变量/存储中。'xxxxx','secret'=>'yyyyyyy','cookie'=>true));if($facebook->getSession()){$uid=$facebook->getUser();$fbme=$facebook->api('/me');}else{$params=array('fbconnect'=>0,'canvas'=>1,'req_perms'=>'pub