我正在尝试从手机上的特定文件路径设置图像.文件路径是手机上的照片.文件路径看起来像这样
/storage/emulated/0/Pictures/picture.jpg
这是代码.
Bitmap image = null;
//trying to set the image from filepath
try {
image = BitmapFactory.decodeStream((InputStream) new URL(filepath).getContent());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
if (image == null) {
//This becomes true because the image is not set
Toast.makeText(getApplicationContext(),"image == null",Toast.LENGTH_LONG).show();
}
Run Code Online (Sandbox Code Playgroud)
最后,图像未设置.
我试图让公司员工在模型中使用多种方法.但是我得到了这个错误.
Fatal error: Class 'Employee' not found (View: /home/vagrant/Code/laravel/resources/views/frontpage.blade.php)
Run Code Online (Sandbox Code Playgroud)
这是我的控制器:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Company;
use App\Employee;
public function index()
{
$data = Company::get();
$data = array(
'companies' => $data,
);
return view('frontpage', $data);
}
Run Code Online (Sandbox Code Playgroud)
这是我的模型:第一个是Company.php
namespace App;
use Illuminate\Database\Eloquent\Model;
use App\Employee;
class Company extends Model{
protected $table = 'company';
public function employee()
{
return $this->hasMany('Employee', 'company_id', 'id');
}
}
Run Code Online (Sandbox Code Playgroud)
这是另一个模型Employee.php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Employee extends Model{
public $table = "employee";
}
Run Code Online (Sandbox Code Playgroud)
这是观点
@extends('layouts.master')
@section('content') …
Run Code Online (Sandbox Code Playgroud) 当我在WAMP服务器上运行curl时,cURL无效.任何人都知道如何为PHP 7.0+激活这个?
我试图在php.ini中取消注释extension = php_curl.dll
这是我的错误消息:
cURL Error #:SSL certificate problem: unable to get local issuer certificate
Run Code Online (Sandbox Code Playgroud) 我使用Summernote作为所见即所得的编辑器,但我有一个问题。我的大部分文本编辑都在代码视图中进行,问题是如果您在代码视图中提交表单,则编辑的文本不会被保存。
出于某种原因,我需要在代码视图和所见即所得视图之间切换以保存编辑的文本。任何人都有关于如何解决这个问题的任何线索?
我在代码视图中看到过Not save content ?#127但它对我不起作用。
这是我的代码。
$(document).ready(function() {
$('#desc').summernote({
height: 1000, // set editor height
minHeight: null, // set minimum height of editor
maxHeight: null, // set maximum height of editor
focus: true, // set focus to editable area after initializing summernote
codemirror: {
mode: 'text/html',
htmlMode: true,
lineNumbers: true,
theme: 'monokai'
},
callbacks: {
onBlur: function() {
//should probably do something here
},
onInit: function() {
console.log('Summernote is launched');
$(this).summernote('codeview.activate');
} …
Run Code Online (Sandbox Code Playgroud) 基本上我不想做的是自动更改 de 前缀,所以我只有一个视图。这些链接可能看起来像这样。
{{URL::to('california/search')}}
{{URL::to('florida/search')}}
{{URL::to('arkansas/search')}}
Run Code Online (Sandbox Code Playgroud)
我使用 Laravel 5.2
这是我使用的控制器:
//Controllers for states
Route::group(array('prefix' => 'california', "namespace" => 'Test' ), function() {
Route::get("/all", "CalifornaPositionController@all");
Route::get('/search',['uses' => 'CalifornaPositionController@getSearch','as' => 'search']);
Route::get('/show/{id}', 'CalifornaPositionController@show');
});
Route::group(array('prefix' => 'florida', "namespace" => 'Test' ), function() {
Route::get("/all", "FloridadPositionController@all");
Route::get('/search',['uses' => 'FloridadPositionController@getSearch','as' => 'search']);
Route::get('/show/{id}', 'FloridadPositionController@show');
});
Route::group(array('prefix' => 'arkansas', "namespace" => 'Test' ), function() {
Route::get("/all", "ArkansasPositionController@all");
Route::get('/search',['uses' => 'ArkansasPositionController@getSearch','as' => 'search']);
Route::get('/show/{id}', 'ArkansasPositionController@show');
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试一次插入一个数组,我也想要更新,如果存在.但是我得到了这个错误.
$jobs = array();
//Iterate over the extracted links and display their URLs
foreach ($links as $link){
$data = get_job_info($link);
$jobs[] = [
'title' => $data['title'],
'full_desc' => $data['desc'],
'to_date' => $data['date'],
'ad_type' => 'fb'
];
}
}
DB::table('customer_position')->insert($jobs);
Run Code Online (Sandbox Code Playgroud) php ×4
laravel ×3
laravel-5 ×3
eloquent ×2
android ×1
bitmapimage ×1
curl ×1
java ×1
javascript ×1
jquery ×1
mysql ×1
php-7 ×1
routes ×1
summernote ×1
url ×1
wamp ×1
windows-10 ×1