php严格标准:()的声明应该与第487行的......兼容

时间:2017-09-17 18:20:25

标签: php

我的问题是声明错误 我读了其他一些问题,但没有一个没有解决我的问题。 我不想隐藏此错误通知。如何解决此错误? 我的错误通知是;

  

严格标准:MyFilesPolicy :: getFileList()的声明应该   兼容MyFile :: getFileList($ area = false,$ extra_filter =   false,$ order_by = false,$ from = false,$ num_elem = false)in   /forum/lib/lib.myfiles.php   在线...

类Myfile {

const crypto = require('crypto')
const WebSocket = require('ws')

var apiKey = ''
var apiSecret = ''

const cexioWs = new WebSocket('wss://ws.cex.io/ws/', {perMessageDeflate: false });

function createSignature(timestamp, apiKey, apiSecret){ 
    var hmac = crypto.createHmac('sha256', apiSecret );
    hmac.update( timestamp + apiKey );
    return hmac.digest('hex');
}

function createAuthRequest(apiKey, apiSecret ){
    var timestamp = Math.floor(Date.now() / 1000);
    var args = { e: 'auth', auth: { key: apiKey,
        signature: createSignature(timestamp, apiKey, apiSecret), timestamp: timestamp } };
    var authMessage = JSON.stringify( args );
    return authMessage;
}

cexioWs.on('message', (mess, error) => {
        console.log("cexio message");
        console.log(mess);
    let JSONMess = JSON.parse(mess);
    if (JSONMess.e === "connected") {
        cexioWs.send(createAuthRequest(apiKey, apiSecret));
        cexioWs.send(JSON.stringify({
            e: "subscribe",
            rooms: [
                "tickers"
            ]
        }));
    }
    if (JSONMess.e === "ping") {
        console.log("pong message");
        cexioWs.send(JSON.stringify({e: "pong"}));
    }
});

类MyFilesPolicy扩展了MyFile {

function getFileList($area = false, $extra_filter = false, $order_by = false, $from = false, $num_elem = false) {

    $query = "
    SELECT ".implode(', ', $this->arr_field)."
    FROM ".$this->getFilesTable()."
    WHERE owner = '".$this->id_user."'";
    if($area !== false) $query .= " AND area = '".$area."'";
    if($extra_filter !== false) $query .= $extra_filter;
    if($order_by !== false) $query .= " ORDER BY ".$this->arr_field[$order_by]."";
    else $query .= " ORDER BY title";

    if($from !== false) {
        $query .= " LIMIT ".$from.", ".$num_elem;
    }

    $re_query = $this->_query($query);
    return $re_query;
}
}

2 个答案:

答案 0 :(得分:1)

您错过了扩展类

中参数列表中的参数$extra_filter
function getFileList($area = false, $order_by = false, $from = false, $num_elem = false) {

所以像这样添加

function getFileList($area = false, $extra_filter = false, $order_by = false, $from = false, $num_elem = false) {

答案 1 :(得分:0)

发现差异,我给了你一个小小的暗示:

类Myfile

function getFileList($area = false, $extra_filter = false, $order_by = false, $from = false, $num_elem = false) {

MyFilesPolicy类

function getFileList($area = false,                        $order_by = false, $from = false, $num_elem = false) {

错误说:

  

MyFilesPolicy :: getFileList()应与之兼容   MyFile的:: getFileList()