问题: 解决办法: 1.电脑左下角开始--搜索”php.exe“,记录下路径,如我的是C:\xampp\php\ 2.点击phpstorm里的configured PHP Interpreter(见下图) 3.点击下图里的红框 4.在下图红框输入步骤1里的php的文件夹路径确认即可。 PS:本人是新手在自学PHP,有什么说得不对的,麻烦各位指出。谢谢。 from:http://www.bubuko.com/infodetail-649755.html
View Details<?php /** * Created by JetBrains PhpStorm. * User: Administrator * Date: 12-9-18 * Time: 上午11:03 * To change this template use File | Settings | File Templates. */ // ctrl+j 插入活动代码提示 // ctrl+alt+t 当前位置插入环绕代码 // alt+insert 生成代码菜单 // ctrl+q 查看代码注释 // ctrl+d 复制当前行 // ctrl+y 删除当前行 // shift+F6 重命名 // ctrl+shift+u 字母大小写转换 // ctrl+f 查找 // ctrl+r 替换 // F4 查看源码 // ctrl+shift+i 查看变量或方法定义源 // ctrl+g 跳转行 // ctrl+alt+F12 跳转至当前文件在磁盘上的位置 // alt+down 查看下一个方法 // alt+up 查看上一个方法 // ctrl+alt+l 重新格式化代码 // ctrl+shift+down statement向下移动 // ctrl+shift+up statement向上移动 // alt+shift+down line向下移动 // alt+shift+up line向上移动 // ctrl+/ 行注释 // ctrl+shift+/ 块注释 // ctrl+shift+n 打开工程中的文件 // ctrl+b 跳到变量申明处 // ctrl+[] 匹配 {}[] // ctrl+shift+]/[ 选中块代码<table>….</table> // ctrl+x 剪切行 // ctrl+shift+v 复制多个文本 // alt+left/right 标签切换 // ctrl+p 显示默认参数
View Detailsphpstorm 设置多项目并存 phpstorm 或 webstorm设置多个项目可以并存: File -> settings -> Directories -> Add Content Root 中添加你当前的工程目录。 from:http://www.bestphper.cn/article-46.html
View Details介绍 枚举是一个指定的常数,其基础类型可以是除 Char 外的任何整型。 如果没有显式声明基础类型,则使用 Int32。 编程语言通常提供语法来声明由一组已命名的常数和它们的值组成的枚举。 定义 默认基数从O开始,也可指定数值。 enum Days { Saturday=1, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday }; enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 }; 使用 Colors myColors = Colors.Red; string strColor=myColors.tostring(); int IntColor=(int)myColors ; 位或 Colors myColors = Colors.Red | Colors.Blue | Colors.Yellow; 位与 Colors myColors = Colors.Red & Colors.Blue & Colors.Yellow; 遍历 foreach (string s in Enum.GetNames(typeof(Days))) Response.Write(s + "--" + Enum.Parse(typeof(Days), s).ToString()); 转换 Colors mc=Colors Enum.Parse(typeof(Colors ), "red"); if (System.Enum.IsDefined(typeof(Days), "Monday")) Days ds= (Days)Enum.Parse(typeof(Days), "Monday"); 实例二: public enum NoticeType { Notice = 'A', LabRule = 'H', HotInformation = 'N', Column = 'C', All = '1', Null = '0' } //新建枚举类型 NoticeType noticeType1 = NoticeType.Column; //把枚举类型转换为string d="Column" string d = noticeType1.ToString(); //取得枚举类型的基数 dd=’C' char dd = (char)noticeType1; //通过基数取得对应的枚举类型 noticeType2 = NoticeType.Notice //(NoticeType)’A'; 两种方式都可以 NoticeType noticeType2 = (NoticeType)Char.Parse("A"); //通过名称取得枚举类型 noticeType3 = NoticeType.Notice NoticeType noticeType3 = (NoticeType)Enum.Parse(typeof(NoticeType), "Notice"); from:http://www.cnblogs.com/an-wl/archive/2011/04/14/2015815.html
View Details在Sql Server2005中,如果将某字段定义成日期 时间 类型DateTime,那么在视图中会默认显示成年月日时分秒的方式(如 2013/8/6 13:37:33) 如果只想显示成年月日形式,不要时分秒,那么该怎么办呢? 第一种方法:先设置一个时间显示的模板,然后在需要显示时间的地方调用这个模板就行了。 1、在Share文件夹下,创建一个文件夹DisplayTemplates 2、在DisplayTemplates文件夹下,创建一个视图LongDateTime.cshtml 3、在视图LongDateTime.cshtml中输入代码
1 2 3 |
<span class="variable">@model</span> <span class="constant">System</span>.<span class="constant">DateTime</span> <span class="variable">@Model</span>.<span class="constant">ToLongDateString</span>() |
当然,后面那句也可以换成@Model.ToShortDateString()或其它日期格式。 4、在需要显示日期的地方,由原来的
1 |
<span class="at_rule">@Html.<span class="function">DisplayFor(modelItem => item.PostTime)</span></span> |
替换成
1 |
<span class="at_rule">@Html.<span class="function">DisplayFor(modelItem => item.PostTime,<span class="string">"</span><span class="string">LongDateTime"</span>)</span></span> |
这样就完成了时间格式的显示转换。由原来的显示方式(2013/8/6 13:37:33)显示成了(2013年8月6日) 第二种方法:model类上面添加DisplayFormat的attribute. 如:
1 2 3 4 5 6 7 |
[Display(Name = <span class="string">"</span><span class="string">发布时间:"</span>)] [DisplayFormat(DataFormatString = <span class="string">"</span><span class="string">{0:yyyy年MM月dd日}"</span>)] <span class="keyword">public</span> <span class="keyword">virtual</span> System.DateTime PostTime { <span class="keyword">get</span>; <span class="keyword">set</span>; } |
显示出来后,照样是2013年8月6日这种格式。 from:http://www.cnblogs.com/Rising/p/3722299.html
View Details本文实例讲述了php判断数组中是否存在指定键(key)的方法。分享给大家供大家参考。具体分析如下: php中有两个函数用来判断数组中是否包含指定的键,分别是array_key_exists和isset array_key_exists语法如下 1 array_key_exists($key, $array) 如果键存在返回true isset函数语法如下 1 isset($array[$key]) 如果键存在返回true 演示代码如下: 1 2 3 4 5 6 7 <?php $array = array("Zero"=>"PHP", "One"=>"Perl", "Two"=>"Java"); print("Is 'One' defined? ".array_key_exists("One", $array)."\n"); print("Is '1' defined? ".array_key_exists("1", $array)."\n"); print("Is 'Two' defined? ".isset($array["Two"])."\n"); print("Is '2' defined? ".isset($array[2])."\n"); ?> 返回结果如下: 1 2 3 4 Is 'One' defined? 1 Is '1′ defined? Is 'Two' defined? 1 Is '2′ defined? from:http://www.jb51.net/article/62372.htm
View Detailsphp 5个版本,5.2、5.3、5.4、5.5,怕跟不上时代,新的服务器直接上5.5,但是程序出现如下错误:Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in,看意思就很明了,说mysql_connect这个模块将在未来弃用,请你使用mysqli或者PDO来替代。 解决方法1: 禁止php报错 display_errors = On 改为 display_errors = Off 鉴于这个服务器都是给用户用的,有时候他们需要报错(…都是给朋友用的,^_^),不能这做,让他们改程序吧,看方案2. 解决方法2: 常用的php语法连接mysql如下 <?php $link = mysql_connect('localhost', 'user', 'password'); mysql_select_db('dbname', $link); 改成mysqi <?php $link = mysqli_connect('localhost', 'user', 'password', 'dbname'); 常用mysql建表SQL如下 <?php // 老的 mysql_query('CREATE TEMPORARY TABLE table', $link); // 新的 mysqli_query($link, 'CREATE TEMPORARY TABLE table'); 解决方法三: 在php程序代码里面设置报警级别 <?php error_reporting(E_ALL ^ E_DEPRECATED); Deprecated的问题就这样解决掉了,不过还是建议大家尽快取消mysql的用户,全部都走向mysqli或者mysqlnd等等。mysql确实是太不安全而且太老旧了。 转载请注明出处:http://www.ttlsa.com/html/2502.html
View DetailsASP.NET MVC3中的Model是自验证的,这是通过.NET4的System.ComponentModel.DataAnnotations命名空间完成的。 我们要做的只是给Model类的各属性加上对应的验证标记(Attributes)就可以让MVC3框架帮我们完成验证。我以MVC3项目模板自带的登录 做例子讲解Model的验证。 一、启用客户端验证: 客户端验证主要是为了提高用户体验,在网页不回刷的情况下完成验证。 第一步是要在web.config里启用客户端验证,这在MVC3自带的模板项目中已经有了: <add key="ClientValidationEnabled" value="true"/> <add key="UnobtrusiveJavaScriptEnabled" value="true"/> 然后在被验证的View页面上要加入这样两个JavaScript,注意,他们是依赖于JQuery的: <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> 验证消息的显示有两种,一种是ValidationSummary,它可以显示一份验证消息的汇总,包括从后台Action里返回的消息。 @Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.") 另一种是Model中各属性对应HTML控件的验证消息: @Html.ValidationMessageFor(m => m.UserName) 二、在Model中加入验证标记 MVC3项目模板自带的登录模型类如下: public class LogOnModel { [Required] [Display(Name = "User name")] public string UserName { get; set; } [Required] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } [Display(Name = "Remember me?")] public bool RememberMe { get; set; } } 对比普通的C#类,我们发现每个属性上都多了被方括号“[]”包围的标记。其中,[Required]是验证标记的一种,而[Display]、[DataType]则是为了显示对应的HTML控件,这不在本文讨论范围之内。 除了Required,我们还可以在Model中添加其他有用的验证标记。下面是个较完整的列表: Model类中可以添加的验证标记: 1. 必填字段 [Required] public string FirstName { […]
View Details近日,需要满足测试需求,进行大数据并发测试时,报出【HTTP 错误 500.0 – Internal Server Error E:\PHP\php-cgi.exe – FastCGI 进程超过了配置的活动超时时限】 解决办法: IIS7->FastCGI设置->双击"php-cgi.exe"->"活动超时" 项默认是设置为70(秒),改为600(10分钟,此处根据需求设置可以略高~) from:http://blog.csdn.net/abandonship/article/details/8730524
View DetailsWarning: file_put_contents(): Filename cannot be empty 在 file_unmanaged_save_data() (行 1937 在 D:\WEBSITE\dabeizhou.org\includes\file.inc). 文件无法创建。 Warning: file_put_contents(): Filename cannot be empty 在 file_unmanaged_save_data() (行 1937 在 D:\WEBSITE\dabeizhou.org\includes\file.inc). 文件无法创建。 解决方法: 在 管理 >> 配置 >> 媒体 >>文件系统 里面看看你的临时文件路径是什么,是不是有写权限。
View Details