php-7.1

    1熱度

    2回答

    我無法用log4php記錄「TypeError」。我懷疑這是因爲我最近從php 5.5升級到7.1。 通常情況下,我的語法如下: <? use Logger; class MyClass { /** @var Logger */ private $logger; function __construct(array $configParams)

    -2熱度

    1回答

    創建類的實例後,我想要做的是能夠將該實例的名稱作爲函數調用。例如,考慮下面的類美孚: $bar = new Foo(5); // generates 5 random ints between 0-100 bar(3); // get the third int in the object bar 在PHP這甚至可能還是會涉及與解析器搞亂?提前致謝!

    2熱度

    1回答

    很慢這個簡單的代碼: <?php $time_start = microtime(true); session_start(); echo session_id(); $time_end = microtime(true); $time = ($time_end - $time_start)*1000; echo "<br> Time to get uid: $time milli

    1熱度

    1回答

    我是新來的CI。我有一個功能來訪問數據列表作爲類別。該功能是這樣的: public function get_category_tree() { $this->ci->db->where('is_display','1'); $query = $this->ci->db->get('product_categories'); if ($query->num_ro

    4熱度

    3回答

    我很高興PHP 7.1引入了the iterable pseudo-type。 現在雖然這只是循環遍歷這種類型的參數,但我不清楚當你需要將它傳遞給只接受array或僅僅接受Traversable的PHP函數時該怎麼做。例如,如果你想要做一個array_diff,並且你的iterable是Traversable,你會得到一個array。相反,如果您調用帶有迭代器的函數,則如果iterable是arr

    2熱度

    2回答

    PHPUnit中它很容易斷言,兩個數組包含相同的值: $this->assertEquals([1, 2, 3], [1, 2, 3]); 最新的PHP版本做迭代器和發電機很多更具吸引力的使用,以及PHP 7.1引入了the iterable pseudo-type。這意味着我可以編寫函數來獲取並返回iterable,而不會與我使用簡單的舊array或使用懶惰Generator的事實相結合。

    -1熱度

    1回答

    我用這個代碼,但我的服務器只使用PHP 7.1版本(與mysqli的連接) function GetOne($sql) { $this->Execute($sql); $data = ''; if ($this->result) { $data = mysql_result($this->result, 0); } return $da

    0熱度

    1回答

    我試圖建立我的第一個PHP程序之一,但我掙扎上顯然是愚蠢的問題,我需要你的幫助: 我需要加載和修改XML文件,然後我通過捲曲 這裏給我它是什麼我迄今所做的: $userID='John'; $Action="Read"; $Quarter="2"; $xml=simplexml_load_file("test/xml/testxml.xml") or die("Error: Cannot c

    0熱度

    1回答

    我已經編入索引的記錄,像下面 [0] => Array ( [_index] => test_index [_type] => cool_type [_id] => AVy-s52Kahn1F1gX3B0K [_score] => 1 [_source

    0熱度

    1回答

    我正在使用laravel 5.4,使用php 7.1的couchbase 在我們的系統中,可以創建新用戶。截至目前,電子郵件字段必須是唯一的數據庫用戶表,沒問題,我們在請求中使用此 'email' => 'required|email|unique:users,email,NULL,user_id,datetime_deleted,NULL', 這是工作的罰款。 現在,我們向我們的應用程序發