当前位置: 首页 > news >正文

织梦网站反应速度慢辛集建设网站

织梦网站反应速度慢,辛集建设网站,麦田建设工程网站,企业网站开发课程最近因项目需求,需要对qrcode 进行一些简单修改,发现一些问题,顺便记录一下 目前最新的版本是4.2,在环境是 PHP8 ,laravel11 的版本默认下载基本是4.0以上的 如下列代码 QrCode::format(png)->generate(test);这样…

最近因项目需求,需要对qrcode 进行一些简单修改,发现一些问题,顺便记录一下
目前最新的版本是4.2,在环境是 PHP8 ,laravel11 的版本默认下载基本是4.0以上的

如下列代码

QrCode::format('png')->generate('test');

这样会提示需要安装 imagick 的 PHP扩展,如果我们只是单单需要个普通的qrcode ,可以去掉 format(‘png’),并修改前端代码使用

 <img src="data:image/svg+xml;base64,{!! xxxxxx !!}" style="width: 200px" />

如果需要对qrcode 进行复杂一点的操作,比如在qrcode 中需要添加logo,根据开发文档,就一定需要png 格式,这样就必须在服务器上安装 imagick 扩展了!

因为不想安装 imagick 扩展,于是想找其他办法。无意间发现就版本是不需要 imagick ,然后安装 旧版本

"simplesoftwareio/simple-qrcode": "1.3.*"

使用旧版本,就不会提示安装imagick且生成png 图片

以下是旧版本文档部分


<a id="docs-ideas"></a>
## Simple Ideas#### Print ViewOne of the main items that we use this package for is to have QrCodes in all of our print views.  This allows our customers to return to the original page after it is printed by simply scanning the code.  We achieved this by adding the following into our footer.blade.php file.<div class="visible-print text-center">{!! QrCode::size(100)->generate(Request::url()); !!}<p>Scan me to return to the original page.</p></div>#### Embed A QrCodeYou may embed a qrcode inside of an e-mail to allow your users to quickly scan.  The following is an example of how to do this with Laravel.//Inside of a blade template.<img src="{!!$message->embedData(QrCode::format('png')->generate('Embed me into an e-mail!'), 'QrCode.png', 'image/png')!!}"><a id="docs-usage"></a>
## Usage#### Basic UsageUsing the QrCode Generator is very easy.  The most basic syntax is:QrCode::generate('Make me into a QrCode!');This will make a QrCode that says "Make me into a QrCode!"#### Generate`Generate` is used to make the QrCode.QrCode::generate('Make me into a QrCode!');>Heads up! This method must be called last if using within a chain.`Generate` by default will return a SVG image string.  You can print this directly into a modern browser within Laravel's Blade system with the following:{!! QrCode::generate('Make me into a QrCode!'); !!}The `generate` method has a second parameter that will accept a filename and path to save the QrCode.QrCode::generate('Make me into a QrCode!', '../public/qrcodes/qrcode.svg');#### Format Change>QrCode Generator is setup to return a SVG image by default.>Watch out! The `format` method must be called before any other formatting options such as `size`, `color`, `backgroundColor`, and `margin`.Three formats are currently supported; PNG, EPS, and SVG.  To change the format use the following code:QrCode::format('png');  //Will return a PNG imageQrCode::format('eps');  //Will return a EPS imageQrCode::format('svg');  //Will return a SVG image#### Size Change>QrCode Generator will by default return the smallest size possible in pixels to create the QrCode.You can change the size of a QrCode by using the `size` method. Simply specify the size desired in pixels using the following syntax:QrCode::size(100);#### Color Change>Be careful when changing the color of a QrCode.  Some readers have a very difficult time reading QrCodes in color.All colors must be expressed in RGB (Red Green Blue).  You can change the color of a QrCode by using the following:QrCode::color(255,0,255);Background color changes are also supported and be expressed in the same manner.QrCode::backgroundColor(255,255,0);#### Margin ChangeThe ability to change the margin around a QrCode is also supported.  Simply specify the desired margin using the following syntax:QrCode::margin(100);#### Error CorrectionChanging the level of error correction is easy.  Just use the following syntax:QrCode::errorCorrection('H');The following are supported options for the `errorCorrection` method.| Error Correction | Assurance Provided |
| --- | --- |
| L | 7% of codewords can be restored. |
| M | 15% of codewords can be restored. |
| Q | 25% of codewords can be restored. |
| H | 30% of codewords can be restored. |>The more error correction used; the bigger the QrCode becomes and the less data it can store. Read more about [error correction](http://en.wikipedia.org/wiki/QR_code#Error_correction).#### EncodingChange the character encoding that is used to build a QrCode.  By default `ISO-8859-1` is selected as the encoder.  Read more about [character encoding](http://en.wikipedia.org/wiki/Character_encoding) You can change this to any of the following:QrCode::encoding('UTF-8')->generate('Make me a QrCode with special symbols ♠♥!!');| Character Encoder |
| --- |
| ISO-8859-1 |
| ISO-8859-2 |
| ISO-8859-3 |
| ISO-8859-4 |
| ISO-8859-5 |
| ISO-8859-6 |
| ISO-8859-7 |
| ISO-8859-8 |
| ISO-8859-9 |
| ISO-8859-10 |
| ISO-8859-11 |
| ISO-8859-12 |
| ISO-8859-13 |
| ISO-8859-14 |
| ISO-8859-15 |
| ISO-8859-16 |
| SHIFT-JIS |
| WINDOWS-1250 |
| WINDOWS-1251 |
| WINDOWS-1252 |
| WINDOWS-1256 |
| UTF-16BE |
| UTF-8 |
| ASCII |
| GBK |
| EUC-KR |>An error of `Could not encode content to ISO-8859-1` means that the wrong character encoding type is being used.  We recommend `UTF-8` if you are unsure.#### MergeThe `merge` method merges an image over a QrCode.  This is commonly used to placed logos within a QrCode.QrCode::merge($filename, $percentage, $absolute);//Generates a QrCode with an image centered in the middle.QrCode::format('png')->merge('path-to-image.png')->generate();//Generates a QrCode with an image centered in the middle.  The inserted image takes up 30% of the QrCode.QrCode::format('png')->merge('path-to-image.png', .3)->generate();//Generates a QrCode with an image centered in the middle.  The inserted image takes up 30% of the QrCode.QrCode::format('png')->merge('http://www.google.com/someimage.png', .3, true)->generate();>The `merge` method only supports PNG at this time.
>The filepath is relative to app base path if `$absolute` is set to `false`.  Change this variable to `true` to use absolute paths.>You should use a high level of error correction when using the `merge` method to ensure that the QrCode is still readable.  We recommend using `errorCorrection('H')`.![Merged Logo](https://raw.githubusercontent.com/SimpleSoftwareIO/simple-qrcode/master/docs/imgs/merged-qrcode.png?raw=true)#### Advance UsageAll methods support chaining.  The `generate` method must be called last and any `format` change must be called first.  For example you could run any of the following:QrCode::size(250)->color(150,90,10)->backgroundColor(10,14,244)->generate('Make me a QrCode!');QrCode::format('png')->size(399)->color(40,40,40)->generate('Make me a QrCode!');You can display a PNG image without saving the file by providing a raw string and encoding with `base64_encode`.<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('Make me into an QrCode!')) !!} "><a id="docs-helpers"></a>
## Helpers#### What are helpers?Helpers are an easy way to create QrCodes that cause a reader to perform a certain action when scanned.  #### E-MailThis helper generates an e-mail qrcode that is able to fill in the e-mail address, subject, and body.QrCode::email($to, $subject, $body);//Fills in the to addressQrCode::email('foo@bar.com');//Fills in the to address, subject, and body of an e-mail.QrCode::email('foo@bar.com', 'This is the subject.', 'This is the message body.');//Fills in just the subject and body of an e-mail.QrCode::email(null, 'This is the subject.', 'This is the message body.');#### GeoThis helper generates a latitude and longitude that a phone can read and open the location up in Google Maps or similar app.QrCode::geo($latitude, $longitude);QrCode::geo(37.822214, -122.481769);#### Phone NumberThis helper generates a QrCode that can be scanned and then dials a number.QrCode::phoneNumber($phoneNumber);QrCode::phoneNumber('555-555-5555');QrCode::phoneNumber('1-800-Laravel');#### SMS (Text Messages)This helper makes SMS messages that can be prefilled with the send to address and body of the message.QrCode::SMS($phoneNumber, $message);//Creates a text message with the number filled in.QrCode::SMS('555-555-5555');//Creates a text message with the number and message filled in.QrCode::SMS('555-555-5555', 'Body of the message');#### WiFiThis helpers makes scannable QrCodes that can connect a phone to a WiFI network.QrCode::wiFi(['encryption' => 'WPA/WEP','ssid' => 'SSID of the network','password' => 'Password of the network','hidden' => 'Whether the network is a hidden SSID or not.']);//Connects to an open WiFi network.QrCode::wiFi(['ssid' => 'Network Name',]);//Connects to an open, hidden WiFi network.QrCode::wiFi(['ssid' => 'Network Name','hidden' => 'true']);//Connects to an secured, WiFi network.QrCode::wiFi(['ssid' => 'Network Name','encryption' => 'WPA','password' => 'myPassword']);>WiFi scanning is not currently supported on Apple Products.<a id="docs-common-usage"></a>
##Common QrCode UsageYou can use a prefix found in the table below inside the `generate` section to create a QrCode to store more advanced information:QrCode::generate('http://www.simplesoftware.io');| Usage | Prefix | Example |
| --- | --- | --- |
| Website URL | http:// | http://www.simplesoftware.io |
| Secured URL | https:// | https://www.simplesoftware.io |
| E-mail Address | mailto: | mailto:support@simplesoftware.io |
| Phone Number | tel: | tel:555-555-5555 |
| Text (SMS) | sms: | sms:555-555-5555 |
| Text (SMS) With Pretyped Message | sms: | sms::I am a pretyped message |
| Text (SMS) With Pretyped Message and Number | sms: | sms:555-555-5555:I am a pretyped message |
| Geo Address | geo: | geo:-78.400364,-85.916993 |
| MeCard | mecard: | MECARD:Simple, Software;Some Address, Somewhere, 20430;TEL:555-555-5555;EMAIL:support@simplesoftware.io; |
| VCard | BEGIN:VCARD | [See Examples](https://en.wikipedia.org/wiki/VCard) |
| Wifi | wifi: | wifi:WEP/WPA;SSID;PSK;Hidden(True/False) |<a id="docs-outside-laravel"></a>
##Usage Outside of LaravelYou may use this package outside of Laravel by instantiating a new `BaconQrCodeGenerator` class.use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;$qrcode = new BaconQrCodeGenerator;$qrcode->size(500)->generate('Make a qrcode without Laravel!');
http://www.yayakq.cn/news/849615/

相关文章:

  • 呼玛网站建设网站维护进不去怎么办
  • 东莞合网站建设17zwd一起做业网站
  • 外贸网站建设 义乌网站设计注意因素
  • 可做设计任务的网站微信app下载安装官方版2021
  • 手机在线销售网站 - 百度动漫设计好找工作吗
  • 关于我的大学的网站建设模板老网站301跳转新网站
  • 左右悬停代码网站山东省农村电影监控平台下载
  • 长沙网站建设王道下拉棒网站开发实例教程实训心得
  • 不忘初心 继续前进网站怎么做天津卓信软件开发有限公司
  • 潍坊企业免费建站wordpress 同城生活
  • 口碑好的丹徒网站建设网站关键字被百度收录
  • 租二级目录做网站注册网站有什么用
  • 上海网站建设收费上海单位网站建设
  • 购物网站制作怎么做台州网站建设优化案例
  • 辽阳网站建设多少钱销售管理系统软件哪个好
  • 宝塔面板加wordpress建站推广类网站
  • 社交网站建设计划书建设工程合同司法解释
  • 搜索引擎对网站推广的作用做天猫网站设计难吗
  • 最好网站建设公司网站icp 备案进度查询
  • 举报网站建设情况总结wordpress 站内搜索代码
  • 黄埔做网站的公网站搜索引擎优化方案的案例
  • 十大网站黄页my23777免费域名查询
  • 做玩具什么 网站比较好app开发平台开发
  • 网站开发与管理心得体会丹东做网站的
  • 教学网站开发应用方案网站名称注册保护
  • 淄博网站建设培训学校营销网站建设都是专业技术人员
  • 网站建设都是用什么软件新东方广州门户网站
  • 外贸怎么做站外推广北京做网站好的
  • 便捷网站建设价格家居企业网站建设案例
  • 关键词挖掘爱网站链接买卖平台