草庐IT

load_value

全部标签

php - CodeIgniter - 在异常中使用 load->view()

我希望我的error_404.php显示在我的站点模板View中。我扩展了CI_Exceptions类(MY_Exceptions)并覆盖了show_404()和show_error()方法。现在我想要做的是能够在那里加载一个View文件。最佳情况下,我想在MY_Controller类中加载_header()和_footer()方法。这有可能吗?classMY_ExceptionsextendsCI_Exceptions{publicfunction__construct(){parent::__construct();}functionshow_404($page=''){$head

php - Youtube 嵌入 : How does it calculate the 'width' and 'height' values?

当我在我的PHP代码中使用oembedURL并从我上传的视频中提取$video->width和$video->height时,我得到了值与我看到的与我的Youtube视频相关的任何内容都不匹配。http://youtu.be/p7ftPYU2_0w上传到Youtube的原始视频尺寸:640x336嵌入返回:480x270从Youtube页面UI分享时的最小嵌入选项:560x316有谁知道oembed从哪里得到这些值?为什么默认为480?有没有办法获得真实的视频尺寸,或者至少将默认值提高到640x[proportional_height]?我的目标是在嵌入到我的网站时保留视频的原始尺寸(

php - 我应该使用 set_value() 来重新填充 CodeIgniter 中的表单吗

我的问题是我是否应该使用set_value()来重新填充表单。这么说似乎很奇怪,但我正在创建一个共享Controller功能和View,可用于添加新记录或编辑现有记录。这样做似乎很有意义,因为功能非常相似。因此,如果我们调用现有记录进行编辑,我会这样做:$data['fields']=$this->customer_model->get_customer($id);如果提交表单以保存记录,或者如果我们是第一次添加记录,则如果用户出错,表单有可能重新加载,所以我填充$data['fields']这个方式代替:$data['fields']=array('company'=>$this->

php - 对 array_values 的误解

当我这样做时,我无法正确理解array_values:$array[]='data1';//Iwant[0=>'data1']unset($array[0]);//Iwant[]$array=array_values($array);//Iwant[]butkeysresetted$array[]='data2';//Iwant[0=>'data2']$array[]='data3';//Iwant[0=>'data2',1=>'data3']dump($array);我有结果:array:2[▼1=>"data2"2=>"data3"]但是我想要:array:2[▼0=>"data2

php - 在 simplexml_load_file 上设置超时

我有这个输出rss提要的脚本。我想要做的是让它尝试到达rssurl之类的5秒顶部,如果它不能那么我希望它加载服务器上的备份xml文档。这就是我所拥有的,但它不起作用:channel->itemas$item){echo'guid.'"alt="'.$item->title.'"target="_blank">',substr($item->title,0,62),'...',substr($item->pubDate,4,18),'';}}else{$xml=simplexml_load_file($url);foreach($xml->channel->itemas$item){ec

php - set_value 不适用于 Codeigniter 上的输入类型文件

我正在为我的项目使用HMVCCodeigniter模式。在我的项目中,我需要在输入字段类型为文件的表单上设置值。所以,我很感谢帮助我解决这个问题的他们。我的Controller是test.phpload->library('form_validation');$this->load->helper('url');$this->form_validation->set_rules('fname','FirstName','required|trim');$this->form_validation->set_rules('mname','MiddleName','required|tri

php - PHP 5.6 中的 SoapClient 在使用 HTTPS 时发出带有 "key values mismatch"的警告

使用PHP5.6.9(从PHP5.4更改)升级到Debian8后,我在使用HTTPS端点地址调用SOAPWeb服务时收到此警告:Warning:SoapClient::__doRequest():SSLoperationfailedwithcode1.OpenSSLErrormessages:error:0B080074:x509certificateroutines:X509_check_private_key:keyvaluesmismatch接着是SoapFault:Fatalerror:UncaughtSoapFaultexception:[HTTP]ErrorFetching

php - Symfony 选择类型数组错误 : Unable to transform value for property path: Expected an array

为什么将此表单选项设置为多个时会出现错误。这直接来自Symfonys网站。我只更改了变量名。$builder->add('genre','choice',array('choices'=>array('x'=>'x','y'=>'y','z'=>'z',),'multiple'=>true,));这是错误:Unabletotransformvalueforpropertypath"genre":Expectedanarray.这是我的这个变量的实体类:/***@varstring**@ORM\Column(name="genre",type="text",nullable=true)*

php - 交响乐 4 : "Autowire: you should configure its value explicitly."

我开始使用Symfony4,当我尝试运行我的服务器时遇到以下错误:无法Autowiring服务“App\Controller\CharacterInformation”:方法“__construct()"是类型提示的“字符串”,您应该明确配置它的值。我如何实例化我的类:/***@Route("/")*@returnResponse*/functionmainPage(){$characterInformation=newCharacterInformation('eu');returnnewResponse($characterInformation->getCharacter());

php - Jquery load() 一个包含 JavaScript 的 html 文件

我有一个很大的困境。我想加载一个.html文件,其中包含用于在其中呈现div的javascript(谷歌地图)代码。maps.html看起来像这样:functiongetUrlVars(){varvars=[],hash;varhashes=window.location.href.slice(window.location.href.indexOf('?')+1).split('&');for(vari=0;i//"+name+""+address+"";vartip=markers[i].getAttribute("tip");varicon=customIcons[tip]||{