鍍金池/ 問答/ PHP問答
鐧簞噯 回答

修改端口以啟動(dòng)多個(gè)實(shí)例?
你可以參考一下這個(gè)

修改端口:
https://stackoverflow.com/a/2...

啟動(dòng)多實(shí)例:
https://complete-concrete-con...

我不懂 回答

ajax 請(qǐng)求接口,要獲取返回值,一定要加

    async:false,
    type: "post",
    dataType: "json",
瘋子范 回答
  1. 服務(wù)器是國(guó)內(nèi)主機(jī)嗎?
  2. 服務(wù)器帶寬多少?
放開她 回答
  1. 我覺得這樣寫會(huì)清楚一些:

    <?php
    $str1 = "01 ";
    $str1++;
    var_export($str1);//得到'01 '
    
    $str2 = "01";
    $str2++;
    var_export($str2);//得到2
  2. 參見這里的解釋:

    PHP follows Perl's convention when dealing with arithmetic operations on character variables and not C's. For example, in PHP and Perl $a = 'Z'; $a++; turns $a into 'AA', while in C a = 'Z'; a++; turns a into '[' (ASCII value of 'Z' is 90, ASCII value of '[' is 91). Note that character variables can be incremented but not decremented and even so only plain ASCII alphabets and digits (a-z, A-Z and 0-9) are supported. Incrementing/decrementing other character variables has no effect, the original string is unchanged.

    大意是說,使用自增/自減操作字符串時(shí),可以遞增但不能遞減,另外只支持(字符串的末位為)純 ASCII 字母和數(shù)字 (a-z、a-z 和 0-9)。(另外注意這段中文文檔和英文的對(duì)不上,暫且以英文為準(zhǔn))

  3. 可參考這篇

傳入匿名函數(shù),匿名函數(shù)里面有自己的參數(shù)。調(diào)用的時(shí)候傳參。

不歸路 回答

application\config.php

    // 應(yīng)用調(diào)試模式
    'app_debug'              => true,
陌南塵 回答
strace -iT -p pid

win下apache是多線程模式,建議使用apache訪問靜態(tài)文件試試

更新----------------------------------------------------
在Process Monitor的options中選擇select columns,在其中打開

clipboard.png

如圖,比較completion time中與上一個(gè)時(shí)間間隔較長(zhǎng)的操作

離魂曲 回答

order_id > 4300284 and order_id < 4300263

你的條件寫錯(cuò)了吧
4300284
4300263

入她眼 回答

swoole是運(yùn)行在cli模式下的。

任她鬧 回答

我大概懂了,你看是不是以下你想要的結(jié)果.

$str = <<<EOF
{
    "msg": "ok",
    "status": 1,
    "data": {
        "id": 155,
        "title": "自家的蘋果",
        "content": "<p>自家的,要的聯(lián)系,包郵。</p>",
        "create_time": "2018-01-26 17:24:55",
        "avatar": "https://think.weipintui.com/uploads/20180126/f9a31f83b9ba56afeaddfb8b708692a9.png",
        "pics": [
            {
                "url": "https://think.weipintui.com/uploads/20180126/da426c2213b9653450e5752b4eb20509.png"
            },
            {
                "url": "https://think.weipintui.com/uploads/20180126/bd6cde8ed6a0cb8b3bcb336c19f0d5ae.png"
            },
            {
                "url": "https://think.weipintui.com/uploads/20180126/681eec67bbfa5ad4b370fae019e45ea2.png"
            }
        ]
    }
}
EOF;
$data = json_decode($str,true);
$data = $data['data'];
// 這里是去除掉pics下面的url
$data['pics'] = array_column($data['pics'],'url');
print_r($data);exit;

打印得到的結(jié)果

Array
(
    [id] => 155
    [title] => 自家的蘋果
    [content] => <p>自家的,要的聯(lián)系,包郵。</p>
    [create_time] => 2018-01-26 17:24:55
    [avatar] => https://think.weipintui.com/uploads/20180126/f9a31f83b9ba56afeaddfb8b708692a9.png
    [pics] => Array
        (
            [0] => https://think.weipintui.com/uploads/20180126/da426c2213b9653450e5752b4eb20509.png
            [1] => https://think.weipintui.com/uploads/20180126/bd6cde8ed6a0cb8b3bcb336c19f0d5ae.png
            [2] => https://think.weipintui.com/uploads/20180126/681eec67bbfa5ad4b370fae019e45ea2.png
        )

)

有點(diǎn)lower,請(qǐng)諒解一下

不二心 回答

web目錄下的.htaccsee完整配置,不論是一級(jí)域名還是二級(jí)域名都可以訪問,已經(jīng)經(jīng)過測(cè)試:

Options +FollowSymlinks
IndexIgnore */*
RewriteEngine On

RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

RewriteCond %{SERVER_PORT} !^443$ 
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R]

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

RewriteRule \.svn\/ /404.html
RewriteRule \.git\/ /404.html
安若晴 回答

你這是標(biāo)準(zhǔn)的多對(duì)多模型關(guān)聯(lián)
在你的資源Model里定義個(gè)新方法:

public function tags()
{
    return $this->belongsToMany('標(biāo)簽Model');
}

然后:

資源Model::query()
->tags()
->whereIn('res_id',[1,3,5])
->orderBy('create_time','desc')
->limit(5)
->get();

2017-12-5
試試:

ResModel::whereHas('knowledge', function ($query) use ($knowledge_ids) {
    $query->whereIn('knowledge_id', $knowledge_ids);
})
->orderBy('created_at', 'desc')
->limit(5)
->get();
萌小萌 回答

所謂的php只渲染模板是指路由還是PHP控制然后render頁面,數(shù)據(jù)靠發(fā)送http請(qǐng)求,往JAVA寫的api之類的獲取還是怎么樣

一般有PHP棧了, 很少很少會(huì)融入Java棧,如果二者都有,那么一般指的是PHP拿到請(qǐng)求,對(duì)請(qǐng)求解析,從Java中調(diào)用業(yè)務(wù)所需API最后返回給web服務(wù)器,這么做對(duì)目的限于分布式集群中,Java主演的更后端,對(duì)性能要求更大,擁有更多調(diào)用系統(tǒng)API的最最最后端

大濕胸 回答

你的變量$ceshi好像錯(cuò)了我改了一下,不知道對(duì)不對(duì)

//錯(cuò)誤的
$ceshi='優(yōu)酷視頻$$第1集$http://v.youku.com/$youku#第2集$http://v.youku.com/v_show$youku#第3集$http://v.youku.com/$$$芒果視頻$$第1集$http://vmguo.com$mgtv#第2集$http://v.mangguo.com$mgtv#第3集$http://v.mangguo.com$mgtv';

//我?guī)湍阈薷牧?,其中少?youku這一部分
$ceshi='優(yōu)酷視頻$$第1集$http://v.youku.com/$youku#第2集$http://v.youku.com/v_show$youku#第3集$http://v.youku.com/$youku$$$芒果視頻$$第1集$http://vmguo.com$mgtv#第2集$http://v.mangguo.com$mgtv#第3集$http://v.mangguo.com$mgtv';

$result_array = array();

$temp = explode('$$$',$ceshi);
//var_dump($temp);
foreach($temp as $key=>$value){

    $temp_array = (explode('$$',$value));
    //當(dāng)前的類別
    $category = $temp_array[0];
    //內(nèi)容再次進(jìn)行歸類
    $temp_array = explode('#',$temp_array[1]);
    foreach($temp_array as $key=>$value){
        
        //當(dāng)前的集數(shù)
        $temp_value = explode('$',$value);
        $ep_number = preg_replace('/(第)||(集)/','',$temp_value[0]);
        
        //需要壓入的數(shù)組
        $temp_result['siteSource']= $temp_value[2];
        $temp_result['siteName']= $category;
        $temp_result['siteLink']= $temp_value[1];
    
        //壓入結(jié)果數(shù)組
        $result_array["sitePerEpisode"][$ep_number][]=$temp_result;

    }
}

//$result_array為你要的結(jié)果,你可以var_dump看一下
//var_dump($result_array);

//將結(jié)果數(shù)組轉(zhuǎn)化為json,中文字符會(huì)被轉(zhuǎn)化
$json_result = json_encode($result_array,true);
echo $json_result;

未轉(zhuǎn)化為json的array結(jié)果

array(1) {
  ["sitePerEpisode"]=>
  array(3) {
    [1]=>
    array(2) {
      [0]=>
      array(3) {
        ["siteSource"]=>
        string(5) "youku"
        ["siteName"]=>
        string(12) "優(yōu)酷視頻"
        ["siteLink"]=>
        string(19) "http://v.youku.com/"
      }
      [1]=>
      array(3) {
        ["siteSource"]=>
        string(4) "mgtv"
        ["siteName"]=>
        string(12) "芒果視頻"
        ["siteLink"]=>
        string(16) "http://vmguo.com"
      }
    }
    [2]=>
    array(2) {
      [0]=>
      array(3) {
        ["siteSource"]=>
        string(5) "youku"
        ["siteName"]=>
        string(12) "優(yōu)酷視頻"
        ["siteLink"]=>
        string(25) "http://v.youku.com/v_show"
      }
      [1]=>
      array(3) {
        ["siteSource"]=>
        string(4) "mgtv"
        ["siteName"]=>
        string(12) "芒果視頻"
        ["siteLink"]=>
        string(20) "http://v.mangguo.com"
      }
    }
    [3]=>
    array(2) {
      [0]=>
      array(3) {
        ["siteSource"]=>
        string(5) "youku"
        ["siteName"]=>
        string(12) "優(yōu)酷視頻"
        ["siteLink"]=>
        string(19) "http://v.youku.com/"
      }
      [1]=>
      array(3) {
        ["siteSource"]=>
        string(4) "mgtv"
        ["siteName"]=>
        string(12) "芒果視頻"
        ["siteLink"]=>
        string(20) "http://v.mangguo.com"
      }
    }
  }
}
情已空 回答

解決了。
creatHtmlTree()方法中把static $htmlTree去掉就可以了;

完整版函數(shù):

function creatHtmlTree($tree)
{
    $htmlTree = '<ul>';
    foreach ($tree as $key => $value) {
        $htmlTree .= "<li><span><i class='icon-folder-open'></i>{$value['name']} </span> <a href=''>Goes somewhere</a>";
        if (isset($value['childs']) && is_array($value['childs'])) {
            $html = creatHtmlTree($value['childs']);
            $htmlTree .= $html;
        } 
        $htmlTree .= "</li>";
    }
    $htmlTree .= "</ul>";
    return $htmlTree;
}
誮惜顏 回答

首先看一下你的html標(biāo)簽閉合是否正確。然后檢查一下是否存在全局問題事件監(jiān)聽,如$document.on(click)等。最后,如果使用jQuery 控制單選復(fù)選,最好使用attr和prop兩個(gè)方法同時(shí)控制其狀態(tài)。

葬愛 回答

原因是你的服務(wù)器裝了2個(gè)版本的php
ps:樓上的是個(gè)可行辦法,不過如果php5.3版本沒用,我建議直接卸載掉5.3即可
::)我的服務(wù)器里面也安裝了兩個(gè)版本的php,和你的情況一樣,不過業(yè)務(wù)需要2個(gè)版本而已~