Truyền value từ jquery sang laravel
Thay vì truyền như vậy thì bạn tạo bằng javascript rồi gán vào html luôn nhé
Cách 1:
How to use it:
- Load the latest version of jQuery library and jQuery qrcode plugin in the page.
- Create a container where you want to place the QR code.
Cách 2:
- Load the latest version of jQuery library from google CDN
- Load the jQuery ClassyQR after jQuery library
- Create a container to embed the QR Code
- Call the plugin with options // https://mucinhc.com/
Cách 3:
Step2: Make Ajax Request To Generate QR Code In ajax_generate_code.js file, we will make Ajax request to generate_code.php with required Form input values to generate QR code and display it.
$(document).ready(function() {
$("#codeForm").submit(function(){
.ajax({
url:'generate_code.php',
type:'POST',
data: {formData:("#content").val(), ecc:("#ecc").val(), size:("#size").val()},
success: function(response) {
$(".showQRCode").html(response);
},
});
});
});
Step3: Generate QR Code
In generate_code.php file, we will handle functionality with library PHP QR Code to create QR code image file with QRcode function png() in directory codes using form values and return generated QR code image to display on page.
<?php if(isset($_POST) && !empty($_POST)) { include('library/phpqrcode/qrlib.php'); $codesDir = "codes/"; $codeFile = date('d-m-Y-h-i-s').'.png'; $formData = $_POST['formData']; QRcode::png($formData, $codesDir.$codeFile, $_POST['ecc'], $_POST['size']); echo '<img class="img-thumbnail" src="'.$codesDir.$codeFile.'" />'; } else { header('location:./'); } ?>Đọc từ số sang chữ trong laravel
Bạn đổi sang dùng thư viện này nhé. Mình đang dùng chạy rất ổn luôn, quan trọng là giải quyết được lỗi bạn đang gặp phải.
Installation
Install this package via Composer.
composer require tnkemdilim/money-to-words-converter
Or edit your project's composer.json to require tnkemdilim/money-to-words-converter and then run composer update.
"require": { "tnkemdilim/money-to-words-converter": "^2" }
Example
For working example, checkout the Example folder.
Usage
Note: You should have composer's autoloader included require 'vendor/autoload.php'
Always include Converter namespace to your php file
Basic usage
use TNkemdilim\MoneyToWords\Converter;
// Nigerian currency : naira & kobo
$converter = new Converter("naira", "kobo");
echo ($converter->convert(374));
echo ($converter->convert(23.45));
echo ($converter->convert(748247284782));
echo ($converter->convert(748247284782.34));
echo ($converter->convert('34'));
echo ($converter->convert('2345.34'));
echo ($converter->convert('3453345'));
Other Languages
To convert money value to other languages, you'll need to import the Languages namespace
use TNkemdilim\MoneyToWords\Converter;
use TNkemdilim\MoneyToWords\Languages as Language;
$converter = new Converter("naira", "kobo", Language::FRENCH);
echo ($converter->convert(23.45));
echo ($converter->convert("748247284782"));
Convertion From Other Numeric System
Conversion from other numeric systems are supported in-built, and by default needs no extra configuration to convert into words.
Read more about Numeric systems.
// Chinese numeric system $money = "八百七十二万七千八百二十四";
// Example 1
$converter = new Converter("yen", "sen");
echo ($converter->convert($money));
// Example 2: but convert money value to french
$frenchConverter = new Converter("yen", "sen", Language::FRENCH);
echo ($frenchConverter->convert("八百七十二万七千八百二十四"));
Change Currency
To change the currency of the money to convert
// Dollars & Cents
$converter->setCurrency("dollar", "cents");
echo ($converter->convert(234.34)); // two hundred and thirty-four dollars, thirty-four cents only.
// Pounds & Pence
$converter->setCurrency("pounds", "pence");
echo ($converter->convert('23.3')); // twenty three pounds, 3 pence only.
Change Language Translation
Language for translation can be easily changed as follows. All available languages can be accessed via the TNkemdilim\MoneyToWords\Languages class.
See all available in Languages.
use TNkemdilim\MoneyToWords\Languages as Language;
$converter->setLanguage(Language::LATIN);
$converter->setLanguage(Language::SWAHILI);
$converter->setLanguage(Language::GREEK);
Supported Multi Languages
Tổ chức
Chưa có tổ chức nào.