草庐IT

it_begin

全部标签

php - 检查 url 是否有 http ://at the beginning & inserting if not

这个问题在这里已经有了答案:Howtoaddhttp://ifitdoesn'texistintheURL(8个答案)关闭8年前。我目前正在编辑带有自定义字段输出的wordpress主题。我已成功完成所有编辑,一切正常。我的问题是,如果将url提交到自定义字段中,则echo正是其中的内容,因此如果有人输入www.somesite.com,echo就是那个并将其添加到域的末尾:www.mysite.comwww.somesite.com。我想检查提供的链接是否在开头有http://前缀,如果有则执行两者,但如果没有回显http://在网址之前。我希望我已经尽可能好地解释了我的问题。$cu

php - Laravel 请求 : it's correct injecting Request directly in the controller constructor?

在LaravelController中,如果所有函数都使用Request,那么直接在构造函数而不是函数中注入(inject)Request是否正确?下面的代码有效,我只是想知道它是否正确以及它是否有副作用...classBananaControllerextendsController{protected$request;//requestasanattributeofthecontrollerspublicfunction__construct(Request$request){$this->middleware('auth');$this->request=$request;//R

php - Laravel Eloquent : Update A Model And its Relationships

使用Eloquent模型,您只需调用即可更新数据$model->update($data);但不幸的是,这不会更新关系。如果您也想更新关系,则需要手动分配每个值并调用push()然后:$model->name=$data['name'];$model->relationship->description=$data['relationship']['description'];$model->push();尽管如此,如果您要分配大量数据,它会变得一团糟。我正在寻找类似的东西$model->push($data);//thisshouldassignthedatatothemodelli

php - php ://input & php://output and when it needs to use?是什么意思

很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visitthehelpcenter.关闭11年前。php://input&php://output是什么意思,什么时候需要用到?请举例说明。

安卓磨损 : How does it work an activity life cycle?

我制作了一个带有Activity的可穿戴应用。@OverrideprotectedvoidonCreate(BundlesavedInstanceState){Log.i("WEAR","CREATE");super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);finalWatchViewStubstub=(WatchViewStub)findViewById(R.id.watch_view_stub);stub.setOnLayoutInflatedListener(newWatchViewS

安卓线程 : is it necessary to wait for threads to start before "join"ing them?

我正在实现Android“服务”。在它的“onCreate”中,我想启动并等待另一个线程的完成。ClientServiceLoop是一个Runnable,在run()中有一个while(true)循环,具有简单的返回条件。@OverridepublicvoidonCreate(){super.onCreate();mClientServiceLoopThread=newThread(mClientServiceLoop=newClientServiceLoop(),"ClientServiceLoop");mClientServiceLoopThread.start();try{mCl

android - 动态壁纸渐变条纹 : is it possible to use ARGB_8888 or dithering to fix?

我正在创建一个动态壁纸,我正在Canvas上的每一个Runnable.run()调用颜色不断变化,我希望放一个渐变在顶部,但我正在创建的渐变是带状的可怕的。谷歌搜索了几天后,我想出了两个解决方案:将抖动设置为真将Canvas位图设置为ARGB_8888我试过在getWallpaper()访问器和Paint对象,但它没有帮助(我看不到任何抖动)所以我尝试更改Canvas位图但我不确定如何实际显示它//_canvasBmp=Bitmap.createBitmap(metrics.widthPixels,metrics.heightPixels,Bitmap.Config.ARGB_8888

安卓 5( Lollipop ): Is it possible to make the Background of a Notification transparent?

有什么方法可以让Android中的通知背景透明吗?我通过将RemoteViews与Layout和NotificationCompat结合使用来创建通知:RemoteViewsrv=newRemoteViews(getPackageName(),R.layout.notification_layout);NotificationCompat.BuildermBuilder=newNotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_launcher).setContent(rv);布局的LinearLayout的背景设置为

Javascript : Identify whether it is a desktop Linux or Android

无法使用navigator.userAgent或navigator.platform识别它是linux台式机还是android设备,因为某些android设备有字符串linux在两者中。详情如下DeviceOSnavigator.platform--------------------------------------------------------------------SamsungGalaxyS3Android4.3Linuxarmv7lHTCOneAndroid4.4.2Linuxarmv7lSonyXperiaZAndroid4.2.2Linuxarmv7lMotoro

android - 改造错误 : Expected BEGIN_ARRAY but was STRING

在api响应中有时可以是数组,有时可以是字符串。这里的细节是Array{"ts":"2015-06-1611:28:33","success":true,"error":false,"details":[{"user_id":"563","firstname":"K.Mathan"},{"user_id":"566","firstname":"Surya"},{"user_id":"562","firstname":"Idaya"}]}有时细节可以是字符串{"ts":"2015-06-1611:28:33","success":true,"error":false,"details":