小编Dar*_*ide的帖子

获取PHP DatePeriod对象的开始和结束日期?

如何获取对象的开始和结束日期DatePeriod

$today  = new \DateTime(date('Y-m-d')); // 2012-05-30
$period = new \DatePeriod($today, new \DateInterval('P1M'), 1);

$stats = new UsageStatistics($period);

class UsageStatistics
{

    protected $period, $sentEmailCount, $autoSentEmailCount;

    public function __construct(\DatePeriod $period)
    {
        $this->period = $period;

        // Current logged in user and email repository
        $user = $this->getUser();
        $repo = $this->getEmailRepository();

        // Get the start and end date for the given period
        $startDate = ...
        $endDate   = ...

        $result = $repo->getAllSentCount($user, $startDate, $endDate);

        // Assigning object properties
    }

    public function getSentEmailCount() { …
Run Code Online (Sandbox Code Playgroud)

php datetime date

5
推荐指数
1
解决办法
3755
查看次数

为什么即使是像phpinfo这样的简单页面也会在特定服务器上切断?

在我的一个客户端生产服务器(Linux,Apache,PHP5)上,部分返回简单页面输出,仅返回给谷歌Chrome.

例如,我已经设置了简单的phpinfo页面,就像 <?php phpinfo(); ?>

当我http://192.168.1.1/phpinfo.php在IE或FireFox上调用该页面时,它很好地返回整个phpinfo页面.但是当我在最新的谷歌浏览器(第30页)中打开此页面时,它会在某些时候被切断.有时它是在1-2"屏幕"之后,当我点击F5时,它会重新加载更长的块 - 5-6"屏幕"长,但仍然不是全部.如果我再次按F5,它将返回2-3个"屏幕"长页,依此类推.

有什么想法这里的问题是什么?打开,关闭谷歌浏览器没有帮助.清理临时文件没有帮助.我没有更多的想法:(

编辑:添加了截图,以更清楚地演示此问题.

1)在Google Chrome中打开phpinfo页面: 第一张图片 你可以立即看到phpinfo的页面很短

2)滚动到底部,你可以看到它只是phpinfo页面的一部分 第二张图片

3)现在按F5重新加载第4页,你可以看到 - 页面现在要长得多 在此输入图像描述

5)但仍然没有完整的PHP信息页面 在此输入图像描述

6)此外,我在Google Chromes控制台中看到了这样的错误 在此输入图像描述

7)这里是所有请求标题(发送/接收) 在此输入图像描述

编辑2: 在FireFox页面中,几乎总是以整页加载,但并非总是如此.有时它也会被切断.与谷歌浏览器的区别仅在于FireFox页面的加载速度至少为90%.在Chrome中,我有时甚至会获得只有5%内容的页面.

php apache output-buffering phpinfo

5
推荐指数
1
解决办法
708
查看次数

meson.build:97:0: 错误:未找到子项目目录且未找到 glib.wrap 文件

我正在尝试安装 Wireshark。有一个 atk 包的依赖。我从网上下载了 atk-2.32.0。atk-2.32.0 只能由介子安装。

以下是我遵循的安装步骤。

  1. 下载攻击力
  2. 下载介子
  3. 移动到 atk 目录。
  4. 使用的命令
../meson-0.50.0/meson.py _build .  
>>However it is give this error:  
>>"meson.build:97:0: ERROR: Subproject directory not found and glib.wrap   
>>file not found."  
Run Code Online (Sandbox Code Playgroud)

请帮助解决此问题。

python linux wireshark

5
推荐指数
1
解决办法
1096
查看次数

如何写“创建用户”?用MySQL准备好的语句

我试过了:

SET @user = 'foo@localhost';
SET @pass = 'bar';
SET @sql = 'CREATE USER ? IDENTIFIED BY ?';
PREPARE stmt FROM $sql;
Run Code Online (Sandbox Code Playgroud)

我得到错误

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? IDENTIFIED BY ?'
Run Code Online (Sandbox Code Playgroud)

我还尝试了多种方法来定义变量,但还是没有运气。

SET @user = "'foo'@'localhost'";
SET @sql = 'CREATE USER ? IDENTIFIED BY ?';
Run Code Online (Sandbox Code Playgroud)

乃至

SET @user = 'foo';
SET @host = 'localhost';
SET @sql …
Run Code Online (Sandbox Code Playgroud)

mysql prepared-statement prepare

3
推荐指数
1
解决办法
984
查看次数