這JB代碼到底想幹嘛?

來源:互聯網
上載者:User
$ln = $this->lengthIndicator($this->QR_MODE_NM, $this->version);$dif = $this->estimateBitsModeNum($run) + 4 + $ln+ $this->estimateBitsMode8(1)         // + 4 + l8- $this->estimateBitsMode8($run + 1); // - 4 - l8if ($dif > 0) {return $this->eat8();}function estimateBitsModeNum($size) {$w = (int)$size / 3;$bits = $w * 10;switch($size - $w * 3) {case 1: {$bits += 4;break;}case 2: {$bits += 7;break;}default: {break;}}return $bits;}function estimateBitsMode8($size) {return $size * 8;}function lengthIndicator($mode, $version) {if ($mode == $this->QR_MODE_ST) {return 0;}if ($version <= 9) {$l = 0;} elseif ($version <= 26) {$l = 1;} else {$l = 2;}return $this->lengthTableBits[$mode][$l];}$lengthTableBits = array(array(10, 12, 14),array( 9, 11, 13),array( 8, 16, 16),array( 8, 10, 12));


回複討論(解決方案)

你這斷章取義的,誰知到在幹什麼

代碼不完整,看不出這JB代碼到底想幹嘛。

愛幹嘛幹嘛,接分!

得了,結賬吧

完全看不懂!

產生二維碼的吧

產生二維碼的吧

真是遇見高手了。求解釋

這代碼太短了,好像是二維碼

這代碼太短了,好像是二維碼

為什麼eat12,14的情況。

不懂二維碼的原理,看代碼能看懂嗎?
Numeric mode 數字編碼,從0到9。如果需要編碼的數位個數不是3的倍數,那麼,最後剩下的1或2位元會被轉成4或7bits,則其它的每3位元字會被編成 10,12,14bits 對應你的 estimateBitsModeNum
不同version下編碼的位元:
對應你的 lengthIndicator

我也不懂,幫你找的資料: http://coolshell.cn/articles/10590.html#jtss-tsina

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.