mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 03:58:28 +00:00
:octocat:
This commit is contained in:
+7
-7
@@ -40,13 +40,13 @@ $options = new QROptions([
|
||||
],
|
||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
|
||||
'svgDefs' => '
|
||||
<linearGradient id="rainbow" x1="100%" y2="100%">
|
||||
<stop stop-color="#e2453c" offset="2.5%"/>
|
||||
<stop stop-color="#e07e39" offset="21.5%"/>
|
||||
<stop stop-color="#e5d667" offset="40.5%"/>
|
||||
<stop stop-color="#51b95b" offset="59.5%"/>
|
||||
<stop stop-color="#1e72b7" offset="78.5%"/>
|
||||
<stop stop-color="#6f5ba7" offset="97.5%"/>
|
||||
<linearGradient id="rainbow" x1="1" y2="1">
|
||||
<stop stop-color="#e2453c" offset="0"/>
|
||||
<stop stop-color="#e07e39" offset="0.2"/>
|
||||
<stop stop-color="#e5d667" offset="0.4"/>
|
||||
<stop stop-color="#51b95b" offset="0.6"/>
|
||||
<stop stop-color="#1e72b7" offset="0.8"/>
|
||||
<stop stop-color="#6f5ba7" offset="1"/>
|
||||
</linearGradient>
|
||||
<style><![CDATA[
|
||||
.dark{fill: url(#rainbow);}
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ namespace chillerlan\QRCode\Data;
|
||||
|
||||
use chillerlan\QRCode\Common\{BitBuffer, Mode};
|
||||
|
||||
use function array_flip, ceil, ord, str_split, substr;
|
||||
use function array_flip, ceil, str_split, substr, unpack;
|
||||
|
||||
/**
|
||||
* Numeric mode: decimal digits 0 to 9
|
||||
@@ -100,8 +100,8 @@ final class Number extends QRDataModeAbstract{
|
||||
private function parseInt(string $string):int{
|
||||
$num = 0;
|
||||
|
||||
foreach(str_split($string) as $chr){
|
||||
$num = ($num * 10 + ord($chr) - 48);
|
||||
foreach(unpack('C*', $string) as $chr){
|
||||
$num = ($num * 10 + $chr - 48);
|
||||
}
|
||||
|
||||
return $num;
|
||||
|
||||
Reference in New Issue
Block a user