.image-upload > input
{
display: none;
}
.upload-icon{
width: 100px;
height: 97px;
border: 2px solid #5642BE;
border-style: dotted;
border-radius: 18px;
}
.upload-icon img{
width: 60px;
height: 60px;
margin:19px;
cursor: pointer;
}Run Code Online (Sandbox Code Playgroud)
<form>
<div class="image-upload">
<label for="file-input">
<div class="upload-icon">
<img src="https://image.flaticon.com/icons/png/128/61/61112.png">
</div>
</label>
<input id="file-input" type="file"/>
</div>
</form>Run Code Online (Sandbox Code Playgroud)
我只想上传具有输入类型文件的图像,当选择要上传的图像时,上传图像图标将在选定图像内替换(如下面的截图)。我没有写任何脚本。脚本应该是什么?

我的工作purchaseOrder和purchaseOrderDetails数据库表。
我将数据从一种形式保存到两个表中。这是项的附加行表purchaseOrderrDetails。插入数据工作正常。
但是,现在我需要更新表purchaseOrder,并purchaseOrderDetails在同一时间。
我正在尝试将所有purchaseOrderDetails数据保存到使用附加行系统的表单中。而且,我收到此错误:
该集合实例上不存在属性[id]
什么是正确的代码,请有人帮助我?这是我的控制器方法和下面的编辑视图
Purchase_OrderController.php
//purchase order update form
public function update($id){
$suppliers = Supplier::all();
$categories = Category::all();
$purchaseorder_id = $id;
$purchaseorder= Purchase_Order::where('id', '=', $purchaseorder_id)->get();
$purchaseorder_details_id = Purchase_Order_Details::pluck('purchase_order_id');
$purchaseorder_details = Purchase_Order_Details::where('purchase_order_id', '=', $id)->get();
//$purchaseorder_details = Purchase_Order_Details::with('purchaseorder')->get();
//dd($purchaseorder_details);
return view('user/purchaseorder.edit')->with(['purchaseorder' => $purchaseorder, 'purchaseorder_details' => $purchaseorder_details, 'suppliers' => $suppliers, 'categories' => $categories]);
}
Run Code Online (Sandbox Code Playgroud)
edit.blade.php
<tbody>
<?php $item_row = 0; ?>
@foreach($purchaseorder_details as $pur_detail)
<tr id="item-row-{{ $item_row }}">
<td …Run Code Online (Sandbox Code Playgroud) 我试图在迁移过程中将'is_img'列赋予默认值'0'.当我尝试时 - $table->integer('is_img')->defalut(0)->change();它正在迁移期间删除现有列.在没有change()方法的情况下尝试时,它会在迁移期间给出null值.在迁移期间,我该怎么做才能保留列的默认值?这是Schema轰鸣声 -
public function up()
{
Schema::create('admins', function (Blueprint $table) {
$table->increments('id');
$table->string('email');
$table->string('user_name');
$table->string('password');
$table->string('login_type');
$table->integer('is_img')->defalut(0)->change();
$table->timestamps();
});
}
Run Code Online (Sandbox Code Playgroud) 我试图对Java中的两个64位Long变量执行XOR操作。问题是,当我在变量中添加超过16位时,它将失败。
例如,这有效并返回7:
Long h1 = Long.parseLong("1100001101001101");
Long h2 = Long.parseLong("1100001101000001");
System.out.println(Long.bitCount(h1 ^ h2));
Run Code Online (Sandbox Code Playgroud)
如果我将h1和h2的值增加到:
Long h1 = Long.parseLong("11000110000110100110101101001101");
Long h2 = Long.parseLong("11000011100001101001101101000001");
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
例外在线程“主” java.lang.NumberFormatException:对于输入字符串: “11000110000110100110101101001101”
在
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
在java.lang.Long.parseLong(Long.java:592)
在java.lang.Long.parseLong(Long.java:631)
如果我加倍(64位要计算的),则相同:
Long h1 = Long.parseLong("1100011100011000011010011010110100110110000110100110101101001101");
Long h2 = Long.parseLong("1100001110001100001101001101011010011011100001101001101101000001");
Run Code Online (Sandbox Code Playgroud)
关于为什么为什么失败超过16位有帮助吗?
我有一个在 2.1.7 版本上运行的 Spring Boot 应用程序。我正在尝试使用 Rest Template Builder 实现自定义休息模板,以便设置连接和读取超时。我\xe2\x80\x99已经了解到我需要使用Rest Template Builder,因为我在2.1.7上运行。我的自定义休息模板的代码如下所示。我需要在代码的其他区域调用此休息模板的帮助,因为此休息模板将由我的应用程序的各个组件使用,但我需要帮助来执行此操作。对此的任何建议将不胜感激。谢谢!
\n\npublic abstract class CustomRestTemplate implements RestTemplateCustomizer {\n\n public void customize(RestTemplate restTemplate, Integer connectTimeout, Integer readTimeout) {\n restTemplate.setRequestFactory(new SimpleClientHttpRequestFactory());\n SimpleClientHttpRequestFactory template = (SimpleClientHttpRequestFactory) restTemplate.getRequestFactory();\n template.setConnectTimeout(connectTimeout);\n template.setReadTimeout(readTimeout);\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n 当您转到希望缓存的页面时,在页面上(从源插件)调用 touchNode 会导致以下错误:
类型错误:locationAndPageResources.pageResources 未定义
// Code here checks if the page node in Gatsby cache is the same version
// as backend version. If so 'touch it' and don't recreate.
await Promise.all(result.data.pages.map(async page => {
const pageCacheKey = `cache-${page.url}`
const cacheResult = await pageRecords.getKey(pageCacheKey)
if (cacheResult) {
const node = pageNodes.find(node => {
if (!node.context)
return
return node.context.url == page.url
})
if (node) {
if (node.context.lastPublishedAt == page.lastPublishedAt) {
pageRecords.setKey(pageCacheKey, localPublishedAt)
return touchNode({
nodeId: node.id
})
}
} …Run Code Online (Sandbox Code Playgroud) 查看我在“调用成员函数 getClientOriginalExtension() on bool”时遇到错误的代码
我在 Laravel 上使用图像干预属性在产品表上上传图像。在使用getClientOriginalExtension() 时,我遇到了错误...
public function product_store(Request $request)
{
$image = $request->hasfile('product_image');
$img = $image->getClientOriginalExtension();
$location = public_path('images/products/' .$img);
Image::make($imge)->save($location);
$product_image = new productImage;
$product_image->product_id = 1;
$product_image->image = $img;
$product_image->save();
return redirect() -> route('admin.product.create');
}
Run Code Online (Sandbox Code Playgroud)
在 bool 上调用成员函数 getClientOriginalExtension()
laravel ×3
java ×2
javascript ×2
mysql ×2
php ×2
angularjs ×1
bitcount ×1
css ×1
gatsby ×1
html ×1
jquery ×1
laravel-5 ×1
long-integer ×1
migration ×1
reactjs ×1
retrypolicy ×1
schema ×1
spring ×1
spring-boot ×1
spring-retry ×1
xor ×1