What is QR code
QR code (abbreviated from Quick Response Code) is the trademark for a type of matrix barcode (or two-dimensional barcode) first designed for the automotive industry in Japan. A barcode is a machine-readable optical label that contains information about the item to which it is attached. A QR code uses four standardized encoding modes (numeric, alphanumeric, byte/binary, and kanji) to efficiently store data, extensions may also be used.
In this tutorial we will show you how to generate QR code in Codeigniter framework using qrcode library. This tutorial also contains Demo in which you can see how the code generating and can check output through scanning the code via various QR code scanner available in the market.
Code Sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <?php public function index() { $data['img_url']=""; if($this->input->post('action') && $this->input->post('action') == "generate_qrcode") { $this->load->library('ciqrcode'); $qr_image=rand().'.png'; $params['data'] = $this->input->post('qr_text'); $params['level'] = 'H'; $params['size'] = 8; $params['savename'] =FCPATH."uploads/qr_image/".$qr_image; if($this->ciqrcode->generate($params)) { $data['img_url']=$qr_image; } } $this->load->view('qrcode',$data); } ?> |
Download the code from below or See the Demo
You can download full source code here, also you can check our demo here.
That’s it. Download the full source code with library and implement it on your web app. You can also use this library in Core Php after making some required changes.