草庐IT

it_should_do_something_easy

全部标签

php - CodeIgniter - 如何显示来自 do_upload 的错误消息

我想在重定向链接上显示内容插入的成功消息。这是我的Controller代码:-publicfunctiondo_upload($field){$config['upload_path']='./uploads/';$config['allowed_types']='gif|jpg|png';$config['max_size']='100000';$config['max_width']='3000';$config['max_height']='3000';$this->load->library('upload',$config);if(!$this->upload->do_upl

php - 这个字符串是什么 : Ôªø and how do I avoid it?

我以某种方式设法将Ôªø置于PHP脚本的顶部。那组可怕的字符是什么,我怎么会进入它,我以后该如何暴露和/或避免它?有趣的是,它潜伏在PHP脚本的最顶端,在之前.发送Content-typeheader所需的脚本。因为Ôªø将文件头从文件顶部推开,服务器不断发送自己的文件头,随后发生了2小时的欢闹。我什至看不到nano或bash中的字符串。但我重定向了一个差异,它就在那里。 最佳答案 这是UTF-8byteordermark(寻找EFBBBF)。这是一个标准的事情,不应该给你带来问题,但如果它确实发生了,那么请确保你的源代码编辑器在保

PHP 和 mySQLi : Do I still need to check user input when using prepare statements?

如果我在mySQLi中使用prepare语句,我是否仍然需要以任何方式转义或检查用户输入。例如,如果我有代码:$members=newmysqli("localhost","user","pass","members");$r_email=$_POST['r_email'];$check=$members->prepare("selectuser_idfromuserswhereemail=?");$check->bind_param('s',$r_email);$check->execute();$check->store_result();if($check->num_rows>0

PHP : How to create a string of image binary without saving it to a file?

我有一个图像变量,$im=imagecreatetruecolor(400,300);有没有办法在不将其保存到文件的情况下以jpeg格式获取此图像的二进制字符串?谢谢! 最佳答案 是的,这是可能的(即使没有输出缓冲)。它看起来没有记录,但您可以传递流资源而不是文件名。 关于PHP:Howtocreateastringofimagebinarywithoutsavingittoafile?,我们在StackOverflow上找到一个类似的问题: https://

php - SQLSTATE[08001] : [Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it

我的学说存储库代码无法运行,但我能够正常访问数据库和读取表数据。我得到这个堆栈跟踪:EntityManager->getRepository('AppBundle:Person')insrc\AppBundle\Controller\PersonViewController.php(line18)publicfunctionindexAction(Request$request){$em=$this->getDoctrine()->getManager();$repo=$em->getRepository('AppBundle:Person');$persons=$repo->find

purrr ::地图等于dplyr :: do

阅读https://twitter.com/hadleywickham/status/719542847045636096我了解purrr方法基本上应该替换do.因此,我想知道我会如何使用purrr去做这个:library(dplyr)d%rowwise()%>%do(data_frame(x=seq_len(.$n)))%>%ungroup()##tibble[6x1]#x#*#11#21#32#41#52#63我能得到的最接近的是:library(purrrr)d%>%mutate(x=map(n,seq_len))##Atibble:3x2#nx##11#22#33map_int不起作用

PHP DOM 文档 : How do I get the value of an input field

如何使用PHP的DOMDocument获取没有ID属性的输入字段的值? 最佳答案 XPath让它变得简单,假设这是唯一以“make”作为名称的文本输入:$dom=newDOMDocument();$dom->loadHTML(...);$xp=newDOMXpath($dom);$nodes=$xp->query('//input[@name="make"]');$node=$nodes->item(0);$car_make=$node->getAttribute('value');如果页面上有多个具有该特定字段名称的输入(这完全有

php - "example@something.com"-> "example"PHP

我对正则表达式还很陌生,无法真正弄清楚它是如何工作的。我试过这个:functionchange_email($email){returnpreg_match('/^[\w]$/',$email);}但这只返回bool值true或false,我希望它返回@之前的所有内容。这可能吗?我什至不认为我在这里使用了正确的php函数.. 最佳答案 使用explode尝试更简单的方法:explode('@',$email)[0]; 关于php-"example@something.com"->"exa

php - 结束( explode )严格标准 : Only variables should be passed by reference in

我有这段代码来获取文件的扩展名:$extension=end(explode(".",$_FILES["rfile"]["name"]));这在本地主机上工作正常,但是当我上传在线托管时,它给了我这个错误:StrictStandards:Onlyvariablesshouldbepassedbyreferencein... 最佳答案 为什么不使用pathinfo(PHP>=4.0.3),即:$ext=pathinfo($_FILES["rfile"]["name"])['extension'];现场PHP演示http://ideon

php - 如何删除 https ://from URL and insert http://instead of it in string in PHP?

首先,我需要检查URL字符串,如果URL的协议(protocol)是https,那么我需要替换PHP中的http。所以这个php函数的输入和输出必须是这样的:Input->https://example.com/example/https.phpOutput->http://example.com/example/https.phpInput->http://example.com/example/https.phpOutput->http://example.com/example/https.php 最佳答案 这将确保它位于字符