鍍金池/ 問答/ PHP問答
北城荒 回答

不推薦存數(shù)據(jù)庫中,假如站點訪問量大的時候,對數(shù)據(jù)庫會頻繁寫入,頻繁讀取,從而影響數(shù)據(jù)庫性能。一般用redis memcache存更好些。而且維護過期時間等也方便。設(shè)置key過期時間就好。

慢半拍 回答
'DATA_CACHE_TYPE' => 'Memcache',
'DATA_CACHE_TIME' => '7200',
'DATA_CACHE_PREFIX' => 'demo_',
'MEMCACHED_HOST' => '127.0.0.1',
'MEMCACHED_PORT' => '11211',

不過就算不加上,也是一樣的。只要'DATA_CACHE_TYPE' => 'Memcache',就行。
看看這個文件就知道了。
/ThinkPHP/Library/Think/Cache/Driver/Memcache.class.php

浪婳 回答
  1. 描述不清楚 揣測回答

select * from table where 條件 orderby id DESC 點擊量 DESC limit 50
循環(huán)的時候 拿第一條不就行了?

假如不想打亂時間順序。
去掉點擊量排序,
關(guān)注下mysql的max()的用法

  1. 別的解決思路:

你可以先按照時間順序 加點擊量順序 取出 50條數(shù)據(jù) 。取第一條點擊數(shù)最大的
然后根據(jù)php函數(shù)按時間重排序

array_multisort()
孤巷 回答

打破翻譯成避免就比較容易懂了

別硬撐 回答

一個HTTP請求中不允許一次下載多個文件,如果你有多個文件需要下載,可以打包成一個zip。

也可以用JavaScript去創(chuàng)造多個<a>標(biāo)簽,模擬<a>標(biāo)簽的點擊操作,這樣其實是發(fā)出了3個HTTP請求:

function downloadAll(urls) {
    var link = document.createElement('a');

    link.setAttribute('download', null);
    link.style.display = 'none';

    document.body.appendChild(link);

    for (var i = 0; i < urls.length; i++) {
        link.setAttribute('href', urls[i]);
        link.click();
    }

    document.body.removeChild(link);
};

downloadAll(<?php echo json_encode($urls) ?>);
柒槿年 回答

有可能是ssh的事情,設(shè)置一個key

墨沫 回答

這個 set_ack_handler 對應(yīng)的 confirm 模式是 producer 和 rabbitmq 之間的的 confirm,不是指 producer 和 consumer

通過 $channel->confirm_select();$channel->wait_for_pending_acks(); 指定,具體可以搜搜對應(yīng)的文檔,例如 這篇 https://www.zybuluo.com/dume2...

祉小皓 回答

下載官方案例 查看就行了 官方PHP SDK
下載之后查看里面的案例就行了

或者你看我根據(jù)官方 SDK 打 packagist 包 masterton/alipay-sdk-php

風(fēng)畔 回答

插件問題,和sdk沒關(guān)系,sdk一般只提供服務(wù)端的東西。

壞脾滊 回答

如果是前端生成:

var html += '<div class="form-group well" id="23"> +
            '<div class="row">' +
            // ...
            '</div>';
            
document.getElementById('id').innerHTML = html;
如果覺得拼字符串麻煩,不妨嘗試下模板引擎,或者試試vue、react啥的。

如果是后端返回的html片段:

$('#id').load('/api/xxx');
枕頭人 回答

1.首先你要確定你已經(jīng) brew update 了。
2.其次你可以在命令行運行 brew install php71-igbinary --build-from-source
3.可以在 --build-from-source 后面追加 --HEAD 或者 --devel
4.可能是你的Homebrew 版本過低,嘗試重裝:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果仍然不行的話,可以@我

殘淚 回答

去掉后面整個orWher,只考慮一個條件的情況下(紅框內(nèi)有兩個),把pub_time那個條件當(dāng)作a,閉包內(nèi)的short_time當(dāng)作c,相當(dāng)于a ||(a&c),最后的結(jié)果取決與a,a為true(查詢的到的話),結(jié)果為ture,false則結(jié)果為false,所以等價于a||(a&c) = a

愛是癌 回答

https://mp.weixin.qq.com/debu...

recorderManager.start(options) ,那個只是個回調(diào)函數(shù)吧,當(dāng)錄音開始的時候就會調(diào)用那個函數(shù)。

舊城人 回答

這個需要在程序中使用路由進(jìn)行映射處理。這個一般的MVC框架都支持
比如下面這個組合

[
    '/登陸'=>'user/signup',
    '文章/:id'=>'article/show'
]
  • 當(dāng)訪問http://xxx.com/登陸時,系統(tǒng)將執(zhí)行user控制器的signup方法
  • 當(dāng)訪問http://xxx.com/文章/10(10為文章ID)時,系統(tǒng)將執(zhí)行article控制器的show方法,同時將10作為參數(shù)傳入
悶油瓶 回答
$arr = [
  [
    "id" => 7,
    "parent_id" => 9,
    "child_id" => 11,
    "children" => [
      [
        "id" => 4,
        "parent_id" => 11,
        "child_id" => 2
      ],
      [
        "id" => 5,
        "parent_id" => 11,
        "child_id" => 3]
      ,
      [
        "id" => 6,
        "parent_id" => 11,
        "child_id" => 4
      ]
    ]
  ],
  [
    "id" => 8,
    "parent_id" => 10,
    "child_id" => 11,
    "children" => [
      [
        "id" => 4,
        "parent_id" => 11,
        "child_id" => 2
      ], [
        "id" => 5,
        "parent_id" => 11,
        "child_id" => 3
      ], [
        "id" => 6,
        "parent_id" => 11,
        "child_id" => 4
      ]
    ]
  ]
];

$result = array_map(function ($item) {
  return array_merge([$item['parent_id'], $item['child_id']], array_map(function ($item) {
    return $item['child_id'];
  }, $item['children']));
}, $arr);

print_r($result);
陌顏 回答

那你換成Fillder吧。

離殤 回答

Sometimes people here are not as they could be...

For whatever reason, your php.ini is mis-configured.

One thing to note that all those missing files are actually Windows files (.dll) on Linux these would likely be .so files. I'm assuming your hosting on a Linux server.

First find your php.ini file. If you have command line access via SSH, you can try running:

php --ini
if not you make a simple script, call it test.php like so:

<?php
phpinfo();
?>
Upload the file and run it, something like:

http://www.yoursite.com/test.php

Among the information provided will be the path to php.ini

Once you find it, one option is to edit it and comment out all those extensions, by putting a ";" in front of the line.

Another option is to check if the *.so files exist. Look for them under /usr/lib/php. If they exist, edit your php.ini file to have all those extension end in .so instead of .dll

Finally, if they don't exist, you could install them by using apt-get or yum. An example:

sudo apt-get install php-mbstring

使勁操 回答

之前做過這種需要,我們的實時性可能比你的要求高一點。我是將發(fā)的內(nèi)容和時間放在了rabbitMQ里面,開了多個worker去拿取數(shù)據(jù)處理。