草庐IT

error_id

全部标签

php - 使用 Hashids 库对 Laravel Eloquent 集合中的 ID 进行哈希处理

我从数据库中抓取一组任务作为一个Eloquent集合,然后我将集合发送到我执行foreach的View。这里没有问题。除了,我需要在我的View中引用任务id(URL操作等)。但我显然不想在源代码中使用这个,所以我使用了thislibrary对id进行哈希处理。但是在View中这样做似乎是错误的。有什么方法可以在模型或Controller中散列id吗?下面是我在Controller中调用集合的方式:$tasks=Auth::user()->tasks()->orderBy('created_at','desc')->get();这就是我目前在我的View中散列id的方式:id))}}"

php - codeigniter - 升级 php 和 apache 后未找到 fatal error 类 'CI_Controller'

我在升级Apache从2.2.19.0到2.4.16.0和php从5.3.7.0到5.6.12.0现在我得到这个错误:Fatalerror:Class'CI_Controller'notfoundinsystem\core\CodeIgniter.phponline234CodeIgniter.php第221-235行//LoadthebasecontrollerclassrequireBASEPATH.'core/Controller.php';/***ReferencetotheCI_Controllermethod.**ReturnscurrentCIinstanceobject

javascript - 如何将 div id 放入 php 变量中?

如何在提交表单后将此id放入PHP变量中?我需要将总值传递给PHP变量。请帮我解决这个问题。TotalPriceTotal:0这是脚本$('#totalvalue').click(function(){$.post("package.php",{id:$(this).attr('id')},function(response){alert(response);});}); 最佳答案 您想要div标签之间的值,而不是ID,对吗?改变这个:id:$(this).attr('id')对此:id:$(this).text()如果要在页面上显

php - 用逗号和引号分隔 ID

我得到了一组要在IN语句(sql)中使用的ID。然而,这只有在正确写入时才能完成,例如:IN('12','13','14')如何将一组ID更改为该格式?这意味着在每个数字周围添加引号,并在每个数字后用引号括起一个逗号,数组中的最后一个除外。我的代码:$parent="SELECT*FROM`web_categories`WHERE`parent_id`=13ANDpublished=1";$parentcon=$conn->query($parent);$parentcr=array();while($parentcr[]=$parentcon->fetch_array());fore

php - fatal error : Class 'Paypal\Api\Payer' not found en sdk Paypal

我用composer安装了PayPalSDK但我的php文件CHECKOUT.php错误是:Fatalerror:Class'Paypal\Api\Payer'notfoundinC:\xampp\htdocs\pagos\checkout.phponline23结帐.php:setPaymentMethod("paypal");$item=newItem();$item->setName($descripcion)->setCurrency('MXN')->setQuantity(1)->setPrice($precio);$itemList=newItemList();$itemL

php - 代码点火器 3 : Can't catch database error using try catch block

我正在开发一个api,它处理来自客户端的请求,然后从服务器获取响应(使用codeigniter3开发)并将其转发回客户端。但是,如果出现任何数据库错误,例如重复ID或空值,模型类将无法处理该错误以显示正确的错误消息。我试过trycatchblock但还没有成功。这是模型:publicfunctionadd(){try{$this->db->trans_start(FALSE);$this->db->insert('users',$preparedData);$this->db->trans_complete();if($this->db->trans_status()===FALSE)

php - (Laravel) 解析错误 : syntax error, 意外 '<'

我在说Parseerror:syntaxerror,unexpected'时遇到了一些错误这是我在Laravel中的观点@for($i=0;$i{{date("Y",strtotime($data[$i]->date))}}{{date("M",strtotime($data[$i]->date))}}{{$data[$i]->total}}{{$st[$i]}}{{$bt[$i]}}@if({{$ftm[$i]}}==null)@elseif({{$ftm[$i]}}!=null){{$ftm[$i]}}@endif{{$pe[$i]}}@endfor有什么解决办法吗?

php - Wordpress - 通过 slug 获取标签 ID

我正在尝试通过slug获取标签的id\name。那是我的代码:$tag=get_term_by('slug','hedoms','post_tag');$tag_id=$tag->term_id;name;?>我是从这里拿来的:https://codex.wordpress.org/Function_Reference/get_term_by我的标签带有slughedoms但为空,则不返回值。我已经用类别尝试了这个函数(get_term_by)-并且结果相同。第二个字段是slug。但如果我使用id而不是slug,它工作正常:$tag_id=get_term_by('id',97,'po

php - 如何摆脱 Zend Framework 3 "getting started"教程中的 fatal error ?

我一直在尝试学习ZendFramework3的“入门”教程。一切顺利,但是一旦我学习了“表单和操作”,一切就停止了。教程在这里:https://docs.zendframework.com/tutorials/getting-started/forms-and-actions/这是我不断收到的错误:Fatalerror:DeclarationofZend\Form\Form::bindValues(array$values=Array)mustbecompatiblewithZend\Form\Fieldset::bindValues(array$values=Array,?array

php - 如何取消设置克隆的 PHP 对象的 ID

我正在从事一个使用Docrtrine和Symfony2.7的项目。我有一个要克隆的文档实体,当然我需要确保我没有重复的主键。到目前为止,这是我尝试过的:/***Document**@ORM\Table(name="documents")*/classDocument{publicfunction___clone(){$newObj=clone$this;$newObj->id=null;return$newObj;}...}这似乎并没有太大作用,但是,当我调用clonemyDocument然后尝试坚持时,我仍然收到此消息:SQLSTATE[23000]:Integrityconstra