鍍金池/ 問答/ PHP問答
怣痛 回答

你這個是屬于跨域不被允許的問題,我也遇到過。
當(dāng)時我的解決方法是,在config/index.js里面的proxyTable{} 設(shè)置代理解決的。
下面是我設(shè)置的三個代理你可以參考一下:
proxyTable: {

        //獲取單首歌曲信息
        '/getsongapi': {
            target: 'http://www.kugou.com/',//請求數(shù)據(jù)的地址
            secure: false,//false:請求方式為http,true:請求方式為https
            changeOrigin: true,//是否進(jìn)行跨域
            pathRewrite: {
                '^/getsongapi': '/'  //target后面的文件夾名字    
            },
        },
        //從m.kugou.com獲取數(shù)據(jù)
        '/api': {
            target: 'http://m.kugou.com/', //請求數(shù)據(jù)的地址
            secure: false, //false:請求方式為http,true:請求方式為https
            changeOrigin: true, //是否進(jìn)行跨域
            pathRewrite: {
                '^/api': '/' //target后面的文件夾名字    
            },

        },
        '/search': {
            target: 'http://mobilecdn.kugou.com/', //請求數(shù)據(jù)的地址
            changeOrigin: true,
            pathRewrite: {
                '^/search': '/' //target后面的文件夾名字    
            }

        },

        headers: {
            'User-Agent': 'Mozilla / 5.0(Linux; Android 6.0; Nexus 5 Build / MRA58N) AppleWebKit / 537.36(KHTML, like Gecko) Chrome / 55.0 .2883 .87 Mobile Safari / 537.36'
        }

    }
不討囍 回答

封裝一個方法去進(jìn)行調(diào)用調(diào)試

/**
 * 調(diào)試方法
 * @param  array   $data  [description]
 */
function p($data, $die=1)
{
    echo "<pre>";
    print_r($data);
    echo "</pre>";
    if ($die) die;
}

原則上,使用比較運(yùn)算時都應(yīng)該保持 常量在左的原則,但是大多數(shù)人還是習(xí)慣性變量在左,但是現(xiàn)代IDE可以通過代碼檢查自動矯正。比如 PHPStorm

焚音 回答

client_id本來就需要作為參數(shù)傳上去的,但很多人在服務(wù)端寫死,為做限定了

clipboard.png

薔薇花 回答

在 user 里面添加

    /**
     * @inheritdoc
     */
    public static function findIdentityByAccessToken($token, $type = null)
    {
                //if ($type == '')
        // throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
        //return static::findOne(['access_token'=>$token , 'status' => self::STATUS_ACTIVE],>;
        return static::find()
        ->where(['access_token'=>$token , 'status' => self::STATUS_ACTIVE])
        ->andWhere(['>','expire_at',time()]) 
        ->one();
        // throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
    }
網(wǎng)妓 回答

引入了嗎?

引入試試。

clipboard.png

clipboard.png

墨小羽 回答

絕對路徑不行嗎?/js/target.js

孤毒 回答

emmm,foreach去調(diào)用抽象出來獨(dú)立的validator,一點(diǎn)思路,我看了之前的TP5的小項目,好像最多也是一位數(shù)組的校驗(yàn),希望對你有所幫助

舊時光 回答

你沒發(fā)現(xiàn)上一張截圖,也就是data中少的那個參數(shù)guahaoIdundefined么? 你想保留這個字段的話,哪怕賦值為""或者null也行。 你隨便復(fù)制一個試試,看還會不會丟掉。

毀憶 回答

你這個是自動提示的問題,自己百度搜一下就ok了

網(wǎng)妓 回答

Laravel提供了中間件優(yōu)先級, 這是默認(rèn)的中間件優(yōu)先級, 其它的都要排在它們后面

//illuminate/Foundation/Http/kernel.php
protected $middlewarePriority = [
    \Illuminate\Session\Middleware\StartSession::class,
    \Illuminate\View\Middleware\ShareErrorsFromSession::class,
    \Illuminate\Auth\Middleware\Authenticate::class,
    \Illuminate\Session\Middleware\AuthenticateSession::class,
    \Illuminate\Routing\Middleware\SubstituteBindings::class,
    \Illuminate\Auth\Middleware\Authorize::class,
];

你可以在App/Http/Kernel.php中自定義你的優(yōu)先級:

protected $middlewarePriority = [
    \Illuminate\Session\Middleware\StartSession::class,
    \Illuminate\View\Middleware\ShareErrorsFromSession::class,
    \App\Http\Middleware\Cross::class,
    \App\Http\Middleware\Options::class,
    \Illuminate\Auth\Middleware\Authenticate::class,
    \Illuminate\Session\Middleware\AuthenticateSession::class,
    \Illuminate\Routing\Middleware\SubstituteBindings::class,
    \Illuminate\Auth\Middleware\Authorize::class,
];
她愚我 回答

增加一個頂級父節(jié)點(diǎn)字段

舊時光 回答

put是修改記錄 delete是刪除記錄 post是新增 get是獲取

溫衫 回答

參數(shù)傳到后臺不就不安全了嗎?那你驗(yàn)證沒有意義啊

萌吟 回答
server {  
        listen  80;    
        server_name localhost;    
        set $root_path '/data/appname/public';    
        root $root_path;    
        
        index index.php index.html index.htm;    
        
        try_files $uri $uri/ @rewrite;    
        
        location @rewrite {    
            rewrite ^/(.*)$ /index.php?_url=/$1;    
        }    
        
        location ~ \.php {    
        
            fastcgi_pass 127.0.0.1:9000;    
            fastcgi_index /index.php;    
        
            fastcgi_split_path_info       ^(.+\.php)(/.+)$;    
            fastcgi_param PATH_INFO       $fastcgi_path_info;    
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;    
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;    
            include                       fastcgi_params;  
        }    
        
        location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {    
            root $root_path;    
        }    
        
        location ~ /\.ht {    
            deny all;    
        }    
    }

使用這個配置,保證PHP-FPM 已經(jīng)啟動

心沉 回答

比如A表為:questions, B表為answers

那么SQL就是

select a.id, a.title, count(b.pid) as answer_count  from questions a, answers b where a.id=b.pid group by b.pid order by answer_count DESC;
笑忘初 回答

查看是否有nginx用戶,或者www
將nginx,fpm的用戶和組都設(shè)置成上面的用戶,用戶組
修改文件夾所屬用戶

雨蝶 回答
但是這種情況如果多了會不會造成大量廢棄的接口同時在生產(chǎn)環(huán)境

首先這里其實(shí)是3件事,一件叫兼容以前的版本,一件叫新增一個功能,一件叫廢棄之前的版本。

  1. 如果你要兼容,那不叫廢棄的接口,當(dāng)然這里不符合題主需求。
  2. 樓主這里其實(shí)是新增一個功能(盡管他跟原有的功能可能很相似),直接新加就行了。
  3. 而如果你要廢棄,則可以屏蔽掉舊版本代碼(一般是幾次迭代之后,有足夠的警告說明你要廢棄此接口,而通常還不是很好用)

這是比較沒有辦法的事情。主要寫好文檔,每個系統(tǒng)版本的文檔里寫清楚接口的支持和廢棄。

入她眼 回答

你的apache沒有配置PHP模塊吧。
看下你請求的header信息。