草庐IT

service_date

全部标签

php - 错误的 DNS 设置,php_network_getaddresses : getaddrinfo failed Name or service not known, nslookup

问题原来是这样的:Warning:file_get_contents()[function.file-get-contents]:php_network_getaddresses:getaddrinfofailed:Nameorservicenotknownin/home///ppk_hotweb.class.phponline58我也使用了cURL,它只是返回null,仅此而已。(文件和cURL)都已启用。尝试了file_get_contents('google.com')并且成功了!为什么file_get_contents('domain.com.au')不起作用?所以我开始阅读相

php - 如何在 Yii $criteria 中使用 DATE_ADD?

模型.php//Declare$datetime_limitpublicdatetime_limit;Controller.php//datetime_limitshouldbetheactualdatetime+5days$criteria->select="DATE_ADD(NOW(),INTERVAL5DAY)ASdatetime_limit";错误信息:Activerecord"Users"istryingtoselectaninvalidcolumn"DATE_ADD(NOW()".Note,thecolumnmustexistinthetableorbeanexpressi

php - Laravel-4 中的 Facade 和 Service Provider 问题

我正在尝试为laravel-4中的自定义构建类设置Facade。但是,当我尝试加载我的网站时,我收到一条错误消息未找到“PlaneSaleing\ResizerServiceProvider”类我已经按照这里的教程进行操作:http://fideloper.com/create-facade-laravel-4我的自定义类名为Resizer.php并保存在laravel\app\library\中,如下所示:然后我创建了一个名为ResizerFacade.php的Facade,保存在同一个文件夹中,它看起来像这样:第三,我创建了一个ResizerServiceProvider.php文

php - date()中减去n值

我想实现一个Javascript倒数计时器,将月份值减去1。要通过PHP动态获取日期,我使用以下代码:$date="2014:3:1900:00:00";$newDate=date("Y,n,j,H,i",strtotime($date));哪个返回:2014,3,9,00我的问题是如何将值n减去1,所以最终输出将始终是这样的:2014,(3-1),9,00 最佳答案 这是DateTime()的方法(我使用破折号而不是冒号,因为这是日期部分的正确分隔符):$date="2014-3-1900:00:00";$date=(newDat

php - Laravel 5.3 - Carbon Date - UTC 偏移获取时区名称

我正在尝试使用Carbon从Laravel5.3中的UTC偏移量获取时区名称。下面列出的代码如有任何帮助,我们将不胜感激。/*currentcodeiteration*/$utcOffset=-5;$timezone=Carbon::now($utcOffset)->timezone->getName();echo$timezone;//Result:-05:00//ExpectedResult:EST/*triedcode*/$timezone=Carbon::now($utcOffset)->tzName;//Result:-05:00/*WhatIusedpriortoCarbo

php - OAuth2 token ,消息 : '{ "error": "access_denied" }' returned when I try to update Google Calendar using OAuth (Service Account)

我正在使用适用于PHP的Google标准库来使用日历服务,并且我已经通过GoogleAPI控制台为OAuth2.0身份验证设置了一个服务帐户类型。我的主要目标是通过批量更新用户的谷歌日历(例如:user@organisationname.com)(当用户不在线时)。例如。更新用户日历中的事件。当用户登录应用程序(使用OAuth2.0)时,他/她将为应用程序提供“管理您的日历”、“查看您的日历”和“在我不使用应用”以下代码用于使用OAuth2.0登录setApplicationName("GoogleCalendarPHPStarterApplication");$client->set

PHP strtotime/date_create 错误从 "j M, Y"转换为 "Y-m-d"

我有一个关于strtotime和date_create的错误。在我的代码中,它错误地将日期从“2014年9月7日”转换为“2015-09-07”。注意年份不对!这是我的代码:";$listing_date=date_create($listing_date)->format('Y-m-d');print$listing_date."\n";$listing_date="07Sep,2014";print$listing_date."-->";$listing_date=date('Y-m-d',strtotime($listing_date));print$listing_date."

php - file_put_contents(.../bootstrap/cache/services.json) : failed to open stream: No such file or directory

我在运行任何phpartisan命令时一直收到此错误。[ErrorException]file_put_contents(/Applications/MAMP/htdocs/code/bheng/md-bheng/bootstrap/cache/services.json):failedtoopenstream:Nosuchfileordirectory我该如何阻止它? 最佳答案 编辑-如果services.json文件不存在,运行phpartisanserve然后停止强制创建文件。请参阅:laravelservices.jsonn

php - Laravel 5 : How can I load database values into the config/services. php 文件?

我有一个正在开发的Multi-Tenancy应用程序,在添加socialite包时,我尝试从数据库加载特定网站的自定义facebookclient_id和client_secret。我不能真正使用env变量,因为每个站点都有自己的自定义facebook键。您似乎无法真正调用config/services.php文件中的模型方法,因为它可能尚未加载。我已尝试通过请求生命周期文档来解决此问题,但无济于事。我还尝试创建一个服务提供者以从我的业务模型的方法中获取值并将其设置为常量,但是当它在应用程序中可用时,config/services.php文件已经加载.这里是我希望数据库值可用的地方:c

php - Zend_Date : How to get the date of an upcoming day?

我想获得最近的星期一的日期(即不是过去的)。因此,如果今天是星期二(2009年12月1日),我想获取星期一(2009年12月7日)的日期。我如何用Zend_Date做到这一点?解决方案:假设今天是星期二,我们想要获得即将到来的星期一。星期一是future6天。因此,我们将添加6天以获得星期一的日期。//likeso:$tuesday=Zend_Date::now();$nextMonday=$tuesday->addDay(6);要动态地执行此操作,我们需要确定今天是星期几:$today=Zend_Date::now();$dayNumber=$today->get(Zend_Date