我正在使用 PayPal Checkout 在客户端进行基本付款,我询问这是否安全,因为我不希望用户更改金额。
此代码与文档中给出的代码相同。
<script>
paypal.Buttons({
createOrder: function(data, actions) {
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
value: '100'
}
}]
});
}
}).render('#paypal-button-container');
</script>
Run Code Online (Sandbox Code Playgroud) 我在使用 laravel API 从反应输入上传文件时遇到问题。我正在使用 react-hook-form。我的表格和onSave如下
const onSave = data => {
// data.picture = imgs; here I tried changing the picture to event.target.files from the file input, didn't work either.
axios.defaults.headers.common["Authorization"] = "Bearer " + token;
axios
.post(`/api/products/store`, data, {})
.then(res => {
console.log(res);
})
.catch(err => console.log(err));
};
return (
<form onSubmit={handleSubmit(onSave)} encType="multipart/form-data">
<input
type="file"
name="picture[]"
label="Product Picture"
onChange={handlePicInput}
className={classes.inputFile}
multiple
/>
//other inputs
</form>
);
Run Code Online (Sandbox Code Playgroud)
我的帖子请求导致了这个控制器方法
public function store(Request $request)
{
$imageNames = '';
$pictures = (object) $request->file('picture'); …Run Code Online (Sandbox Code Playgroud)