ASP.Net笔记整理(一)
验证码类
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;namespace validateCode.Project.Common
{
public class ValidateCode
{
public ValidateCode()
{
}
/// <summary>
/// 验证码的最大长度
/// </summary>
public int MaxLength
{
get { return 10; }
}
/// <summary>
/// 验证码的最小长度
/// </summary>
public int MinLength
{
get { return 1; }
}
/// <summary>
/// 生成验证码
/// </summary>
/// <param name="length">指定验证码的长度</param>
/// <returns></returns>
public string CreateValidateCode(int length)
{
int[] randMembers = new int[length];
int[] validateNums = new int[length];
string validateNumberStr = "";
//生成起始序列值
int seekSeek = unchecked((int)DateTime.Now.Ticks);
Random seekRand = new Random(seekSeek);
int beginSeek = (int)seekRand.Next(0, Int32.MaxValue - length * 10000);
int[] seeks = new int[length];
for (int i = 0; i < length; i++)
{
beginSeek += 10000;
seeks[i] = beginSeek;
}
//生成随机数字
for (int i = 0; i < length; i++)
{
Random rand = new Random(seeks[i]);
int pownum = 1 * (int)Math.Pow(10, length);
randMembers[i] = rand.Next(pownum, Int32.MaxValue);
}
//抽取随机数字
for (int i = 0; i < length; i++)
{
string numStr = randMembers[i].ToString();
int numLength = numStr.Length;
Random rand = new Random();
int numPosition = rand.Next(0, numLength - 1);
validateNums[i] = Int32.Parse(numStr.Substring(numPosition, 1));
}
//生成验证码
for (int i = 0; i < length; i++)
{
validateNumberStr += validateNums[i].ToString();
}
return validateNumberStr;
}/// <summary>
/// 创建验证码的图片
/// </summary>
/// <param name="containsPage">要输出到的page对象</param>
/// <param name="validateNum">验证码</param>
public void CreateValidateGraphic(string validateCode, HttpContext context)
{
Bitmap image = new Bitmap((int)Math.Ceiling(validateCode.Length * 12.0), 22);
Graphics g = Graphics.FromImage(image);
try
{
//生成随机生成器
Random random = new Random();
//清空图片背景色
g.Clear(Color.White);
//画图片的干扰线
for (int i = 0; i < 25; i++)
{
int x1 = random.Next(image.Width);
int x2 = random.Next(image.Width);
int y1 = random.Next(image.Height);
int y2 = random.Next(image.Height);
g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
}
Font font = new Font("Arial", 12, (FontStyle.Bold | FontStyle.Italic));
//渐变.
LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height),
Color.Blue, Color.DarkRed, 1.2f, true);
g.DrawString(validateCode, font, brush, 3, 2);
//画图片的前景干扰点
for (int i = 0; i < 100; i++)
{
int x = random.Next(image.Width);
int y = random.Next(image.Height);
image.SetPixel(x, y, Color.FromArgb(random.Next()));
}
//画图片的边框线
g.DrawRectangle(new Pen(Color.Silver), 0, 0, image.Width - 1, image.Height - 1);
//保存图片数据
MemoryStream stream = new MemoryStream();
image.Save(stream, ImageFormat.Jpeg);
//输出图片流
context.Response.Clear();
context.Response.ContentType = "image/jpeg";
context.Response.BinaryWrite(stream.ToArray());
}
finally
{
g.Dispose();
image.Dispose();
}
}
/// <summary>
/// 得到验证码图片的长度
/// </summary>
/// <param name="validateNumLength">验证码的长度</param>
/// <returns></returns>
public static int GetImageWidth(int validateNumLength)
{
return (int)(validateNumLength * 12.0);
}
/// <summary>
/// 得到验证码的高度
/// </summary>
/// <returns></returns>
public static double GetImageHeight()
{
return 22.5;
}
}
}
图片处理
using System;
using System.Collections;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;namespace Imageproccess.Project.Common
{
public class ImageClass
{
public ImageClass()
{ }#region 缩略图
/// <summary>
/// 生成缩略图
/// </summary>
/// <param name="originalImagePath">源图路径(物理路径)</param>
/// <param name="thumbnailPath">缩略图路径(物理路径)</param>
/// <param name="width">缩略图宽度</param>
/// <param name="height">缩略图高度</param>
/// <param name="mode">生成缩略图的方式</param>
public static void MakeThumbnail(string originalImagePath, string thumbnailPath, int width, int height, string mode)
{
System.Drawing.Image originalImage = System.Drawing.Image.FromFile(originalImagePath);int towidth = width;
int toheight = height;int x = 0;
int y = 0;
int ow = originalImage.Width;
int oh = originalImage.Height;switch (mode)
{
case "HW": //指定高宽缩放(可能变形)
break;
case "W": //指定宽,高按比例
toheight = originalImage.Height * width / originalImage.Width;
break;
case "H": //指定高,宽按比例
towidth = originalImage.Width * height / originalImage.Height;
break;
case "Cut": //指定高宽裁减(不变形)
if ((double)originalImage.Width / (double)originalImage.Height > (double)towidth / (double)toheight)
{
oh = originalImage.Height;
ow = originalImage.Height * towidth / toheight;
y = 0;
x = (originalImage.Width - ow) / 2;
}
else
{
ow = originalImage.Width;
oh = originalImage.Width * height / towidth;
x = 0;
y = (originalImage.Height - oh) / 2;
}
break;
default:
break;
}//新建一个bmp图片
System.Drawing.Image bitmap = new System.Drawing.Bitmap(towidth, toheight);//新建一个画板
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap);//设置高质量插值法
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;//设置高质量,低速度呈现平滑程度
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;//清空画布并以透明背景色填充
g.Clear(System.Drawing.Color.Transparent);//在指定位置并且按指定大小绘制原图片的指定部分
//第一个:对哪张图片进行操作。
//二:画多么大。
//三:画那块区域。
g.DrawImage(originalImage, new System.Drawing.Rectangle(0, 0, towidth, toheight), new System.Drawing.Rectangle(x, y, ow, oh), System.Drawing.GraphicsUnit.Pixel);try
{
//以jpg格式保存缩略图
bitmap.Save(thumbnailPath, System.Drawing.Imaging.ImageFormat.Jpeg);
}
catch (System.Exception e)
{
throw e;
}
finally
{
originalImage.Dispose();
bitmap.Dispose();
g.Dispose();
}
}
#endregion#region 图片水印
/// <summary>
/// 图片水印处理方法
/// </summary>
/// <param name="path">需要加载水印的图片路径(绝对路径)</param>
/// <param name="waterpath">水印图片(绝对路径)</param>
/// <param name="location">水印位置(传送正确的代码)</param>
public static string ImageWatermark(string path, string waterpath, string location)
{
string kz_name = Path.GetExtension(path);
if (kz_name == ".jpg" || kz_name == ".bmp" || kz_name == ".jpeg")
{
DateTime time = DateTime.Now;
string filename = "" + time.Year.ToString() + time.Month.ToString() + time.Day.ToString() + time.Hour.ToString() + time.Minute.ToString() + time.Second.ToString() + time.Millisecond.ToString();
Image img = Bitmap.FromFile(path);
Image waterimg = Image.FromFile(waterpath);
Graphics g = Graphics.FromImage(img);
ArrayList loca = GetLocation(location, img, waterimg);
g.DrawImage(waterimg, new Rectangle(int.Parse(loca[0].ToString()), int.Parse(loca[1].ToString()), waterimg.Width, waterimg.Height));
waterimg.Dispose();
g.Dispose();
string newpath = Path.GetDirectoryName(path) + filename + kz_name;
img.Save(newpath);
img.Dispose();
File.Copy(newpath, path, true);
if (File.Exists(newpath))
{
File.Delete(newpath);
}
}
return path;
}/// <summary>
/// 图片水印位置处理方法
/// </summary>
/// <param name="location">水印位置</param>
/// <param name="img">需要添加水印的图片</param>
/// <param name="waterimg">水印图片</param>
private static ArrayList GetLocation(string location, Image img, Image waterimg)
{
ArrayList loca = new ArrayList();
int x = 0;
int y = 0;if (location == "LT")
{
x = 10;
y = 10;
}
else if (location == "T")
{
x = img.Width / 2 - waterimg.Width / 2;
y = img.Height - waterimg.Height;
}
else if (location == "RT")
{
x = img.Width - waterimg.Width;
y = 10;
}
else if (location == "LC")
{
x = 10;
y = img.Height / 2 - waterimg.Height / 2;
}
else if (location == "C")
{
x = img.Width / 2 - waterimg.Width / 2;
y = img.Height / 2 - waterimg.Height / 2;
}
else if (location == "RC")
{
x = img.Width - waterimg.Width;
y = img.Height / 2 - waterimg.Height / 2;
}
else if (location == "LB")
{
x = 10;
y = img.Height - waterimg.Height;
}
else if (location == "B")
{
x = img.Width / 2 - waterimg.Width / 2;
y = img.Height - waterimg.Height;
}
else
{
x = img.Width - waterimg.Width;
y = img.Height - waterimg.Height;
}
loca.Add(x);
loca.Add(y);
return loca;
}
#endregion#region 文字水印
/// <summary>
/// 文字水印处理方法
/// </summary>
/// <param name="path">图片路径(绝对路径)</param>
/// <param name="size">字体大小</param>
/// <param name="letter">水印文字</param>
/// <param name="color">颜色</param>
/// <param name="location">水印位置</param>
public static string LetterWatermark(string path, int size, string letter, Color color, string location)
{
#regionstring kz_name = Path.GetExtension(path);
if (kz_name == ".jpg" || kz_name == ".bmp" || kz_name == ".jpeg")
{
DateTime time = DateTime.Now;
string filename = "" + time.Year.ToString() + time.Month.ToString() + time.Day.ToString() + time.Hour.ToString() + time.Minute.ToString() + time.Second.ToString() + time.Millisecond.ToString();
Image img = Bitmap.FromFile(path);
Graphics gs = Graphics.FromImage(img);
ArrayList loca = GetLocation(location, img, size, letter.Length);
Font font = new Font("宋体", size);
Brush br = new SolidBrush(color);
gs.DrawString(letter, font, br, float.Parse(loca[0].ToString()), float.Parse(loca[1].ToString()));
gs.Dispose();
string newpath = Path.GetDirectoryName(path) + filename + kz_name;
img.Save(newpath);
img.Dispose();
File.Copy(newpath, path, true);
if (File.Exists(newpath))
{
File.Delete(newpath);
}
}
return path;#endregion
}/// <summary>
/// 文字水印位置的方法
/// </summary>
/// <param name="location">位置代码</param>
/// <param name="img">图片对象</param>
/// <param name="width">宽(当水印类型为文字时,传过来的就是字体的大小)</param>
/// <param name="height">高(当水印类型为文字时,传过来的就是字符的长度)</param>
private static ArrayList GetLocation(string location, Image img, int width, int height)
{
#regionArrayList loca = new ArrayList(); //定义数组存储位置
float x = 10;
float y = 10;if (location == "LT")
{
loca.Add(x);
loca.Add(y);
}
else if (location == "T")
{
x = img.Width / 2 - (width * height) / 2;
loca.Add(x);
loca.Add(y);
}
else if (location == "RT")
{
x = img.Width - width * height;
}
else if (location == "LC")
{
y = img.Height / 2;
}
else if (location == "C")
{
x = img.Width / 2 - (width * height) / 2;
y = img.Height / 2;
}
else if (location == "RC")
{
x = img.Width - height;
y = img.Height / 2;
}
else if (location == "LB")
{
y = img.Height - width - 5;
}
else if (location == "B")
{
x = img.Width / 2 - (width * height) / 2;
y = img.Height - width - 5;
}
else
{
x = img.Width - width * height;
y = img.Height - width - 5;
}
loca.Add(x);
loca.Add(y);
return loca;#endregion
}
#endregion#region 调整光暗
/// <summary>
/// 调整光暗
/// </summary>
/// <param name="mybm">原始图片</param>
/// <param name="width">原始图片的长度</param>
/// <param name="height">原始图片的高度</param>
/// <param name="val">增加或减少的光暗值</param>
public Bitmap LDPic(Bitmap mybm, int width, int height, int val)
{
Bitmap bm = new Bitmap(width, height);//初始化一个记录经过处理后的图片对象
int x, y, resultR, resultG, resultB;//x、y是循环次数,后面三个是记录红绿蓝三个值的
Color pixel;
for (x = 0; x < width; x++)
{
for (y = 0; y < height; y++)
{
pixel = mybm.GetPixel(x, y);//获取当前像素的值
resultR = pixel.R + val;//检查红色值会不会超出[0, 255]
resultG = pixel.G + val;//检查绿色值会不会超出[0, 255]
resultB = pixel.B + val;//检查蓝色值会不会超出[0, 255]
bm.SetPixel(x, y, Color.FromArgb(resultR, resultG, resultB));//绘图
}
}
return bm;
}
#endregion#region 反色处理
/// <summary>
/// 反色处理
/// </summary>
/// <param name="mybm">原始图片</param>
/// <param name="width">原始图片的长度</param>
/// <param name="height">原始图片的高度</param>
public Bitmap RePic(Bitmap mybm, int width, int height)
{
Bitmap bm = new Bitmap(width, height);//初始化一个记录处理后的图片的对象
int x, y, resultR, resultG, resultB;
Color pixel;
for (x = 0; x < width; x++)
{
for (y = 0; y < height; y++)
{
pixel = mybm.GetPixel(x, y);//获取当前坐标的像素值
resultR = 255 - pixel.R;//反红
resultG = 255 - pixel.G;//反绿
resultB = 255 - pixel.B;//反蓝
bm.SetPixel(x, y, Color.FromArgb(resultR, resultG, resultB));//绘图
}
}
return bm;
}
#endregion#region 浮雕处理
/// <summary>
/// 浮雕处理
/// </summary>
/// <param name="oldBitmap">原始图片</param>
/// <param name="Width">原始图片的长度</param>
/// <param name="Height">原始图片的高度</param>
public Bitmap FD(Bitmap oldBitmap, int Width, int Height)
{
Bitmap newBitmap = new Bitmap(Width, Height);
Color color1, color2;
for (int x = 0; x < Width - 1; x++)
{
for (int y = 0; y < Height - 1; y++)
{
int r = 0, g = 0, b = 0;
color1 = oldBitmap.GetPixel(x, y);
color2 = oldBitmap.GetPixel(x + 1, y + 1);
r = Math.Abs(color1.R - color2.R + 128);
g = Math.Abs(color1.G - color2.G + 128);
b = Math.Abs(color1.B - color2.B + 128);
if (r > 255) r = 255;
if (r < 0) r = 0;
if (g > 255) g = 255;
if (g < 0) g = 0;
if (b > 255) b = 255;
if (b < 0) b = 0;
newBitmap.SetPixel(x, y, Color.FromArgb(r, g, b));
}
}
return newBitmap;
}
#endregion#region 拉伸图片
/// <summary>
/// 拉伸图片
/// </summary>
/// <param name="bmp">原始图片</param>
/// <param name="newW">新的宽度</param>
/// <param name="newH">新的高度</param>
public static Bitmap ResizeImage(Bitmap bmp, int newW, int newH)
{
try
{
Bitmap bap = new Bitmap(newW, newH);
Graphics g = Graphics.FromImage(bap);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.DrawImage(bap, new Rectangle(0, 0, newW, newH), new Rectangle(0, 0, bap.Width, bap.Height), GraphicsUnit.Pixel);
g.Dispose();
return bap;
}
catch
{
return null;
}
}
#endregion#region 滤色处理
/// <summary>
/// 滤色处理
/// </summary>
/// <param name="mybm">原始图片</param>
/// <param name="width">原始图片的长度</param>
/// <param name="height">原始图片的高度</param>
public Bitmap FilPic(Bitmap mybm, int width, int height)
{
Bitmap bm = new Bitmap(width, height);//初始化一个记录滤色效果的图片对象
int x, y;
Color pixel;for (x = 0; x < width; x++)
{
for (y = 0; y < height; y++)
{
pixel = mybm.GetPixel(x, y);//获取当前坐标的像素值
bm.SetPixel(x, y, Color.FromArgb(0, pixel.G, pixel.B));//绘图
}
}
return bm;
}
#endregion#region 左右翻转
/// <summary>
/// 左右翻转
/// </summary>
/// <param name="mybm">原始图片</param>
/// <param name="width">原始图片的长度</param>
/// <param name="height">原始图片的高度</param>
public Bitmap RevPicLR(Bitmap mybm, int width, int height)
{
Bitmap bm = new Bitmap(width, height);
int x, y, z; //x,y是循环次数,z是用来记录像素点的x坐标的变化的
Color pixel;
for (y = height - 1; y >= 0; y--)
{
for (x = width - 1, z = 0; x >= 0; x--)
{
pixel = mybm.GetPixel(x, y);//获取当前像素的值
bm.SetPixel(z++, y, Color.FromArgb(pixel.R, pixel.G, pixel.B));//绘图
}
}
return bm;
}
#endregion#region 上下翻转
/// <summary>
/// 上下翻转
/// </summary>
/// <param name="mybm">原始图片</param>
/// <param name="width">原始图片的长度</param>
/// <param name="height">原始图片的高度</param>
public Bitmap RevPicUD(Bitmap mybm, int width, int height)
{
Bitmap bm = new Bitmap(width, height);
int x, y, z;
Color pixel;
for (x = 0; x < width; x++)
{
for (y = height - 1, z = 0; y >= 0; y--)
{
pixel = mybm.GetPixel(x, y);//获取当前像素的值
bm.SetPixel(x, z++, Color.FromArgb(pixel.R, pixel.G, pixel.B));//绘图
}
}
return bm;
}
#endregion#region 压缩图片
/// <summary>
/// 压缩到指定尺寸
/// </summary>
/// <param name="oldfile">原文件</param>
/// <param name="newfile">新文件</param>
public bool Compress(string oldfile, string newfile)
{
try
{
System.Drawing.Image img = System.Drawing.Image.FromFile(oldfile);
System.Drawing.Imaging.ImageFormat thisFormat = img.RawFormat;
Size newSize = new Size(100, 125);
Bitmap outBmp = new Bitmap(newSize.Width, newSize.Height);
Graphics g = Graphics.FromImage(outBmp);
g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(img, new Rectangle(0, 0, newSize.Width, newSize.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel);
g.Dispose();
EncoderParameters encoderParams = new EncoderParameters();
long[] quality = new long[1];
quality[0] = 100;
EncoderParameter encoderParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, quality);
encoderParams.Param[0] = encoderParam;
ImageCodecInfo[] arrayICI = ImageCodecInfo.GetImageEncoders();
ImageCodecInfo jpegICI = null;
for (int x = 0; x < arrayICI.Length; x++)
if (arrayICI[x].FormatDescription.Equals("JPEG"))
{
jpegICI = arrayICI[x]; //设置JPEG编码
break;
}
img.Dispose();
if (jpegICI != null) outBmp.Save(newfile, System.Drawing.Imaging.ImageFormat.Jpeg);
outBmp.Dispose();
return true;
}
catch
{
return false;
}
}
#endregion#region 图片灰度化
public Color Gray(Color c)
{
int rgb = Convert.ToInt32((double)(((0.3 * c.R) + (0.59 * c.G)) + (0.11 * c.B)));
return Color.FromArgb(rgb, rgb, rgb);
}
#endregion#region 转换为黑白图片
/// <summary>
/// 转换为黑白图片
/// </summary>
/// <param name="mybt">要进行处理的图片</param>
/// <param name="width">图片的长度</param>
/// <param name="height">图片的高度</param>
public Bitmap BWPic(Bitmap mybm, int width, int height)
{
Bitmap bm = new Bitmap(width, height);
int x, y, result; //x,y是循环次数,result是记录处理后的像素值
Color pixel;
for (x = 0; x < width; x++)
{
for (y = 0; y < height; y++)
{
pixel = mybm.GetPixel(x, y);//获取当前坐标的像素值
result = (pixel.R + pixel.G + pixel.B) / 3;//取红绿蓝三色的平均值
bm.SetPixel(x, y, Color.FromArgb(result, result, result));
}
}
return bm;
}
#endregion#region 获取图片中的各帧
/// <summary>
/// 获取图片中的各帧
/// </summary>
/// <param name="pPath">图片路径</param>
/// <param name="pSavePath">保存路径</param>
public void GetFrames(string pPath, string pSavedPath)
{
Image gif = Image.FromFile(pPath);
FrameDimension fd = new FrameDimension(gif.FrameDimensionsList[0]);
int count = gif.GetFrameCount(fd); //获取帧数(gif图片可能包含多帧,其它格式图片一般仅一帧)
for (int i = 0; i < count; i++) //以Jpeg格式保存各帧
{
gif.SelectActiveFrame(fd, i);
gif.Save(pSavedPath + "\\frame_" + i + ".jpg", ImageFormat.Jpeg);
}
}
#endregion
}
}
ASP.Net笔记整理(一)的更多相关文章
- javaweb学习笔记整理补课
javaweb学习笔记整理补课 * JavaWeb: * 使用Java语言开发基于互联网的项目 * 软件架构: 1. C/S: Client/Server 客户端/服务器端 * 在用户本地有一个客户端 ...
- python学习笔记整理——字典
python学习笔记整理 数据结构--字典 无序的 {键:值} 对集合 用于查询的方法 len(d) Return the number of items in the dictionary d. 返 ...
- 从0开始学Swift笔记整理(五)
这是跟在上一篇博文后续内容: --Core Foundation框架 Core Foundation框架是苹果公司提供一套概念来源于Foundation框架,编程接口面向C语言风格的API.虽然在Sw ...
- Deep Learning(深度学习)学习笔记整理系列之(五)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- 学习ReactNative笔记整理一___JavaScript基础
学习ReactNative笔记整理一___JavaScript基础 ★★★笔记时间- 2017-1-9 ★★★ 前言: 现在跨平台是一个趋势,这样可以减少开发和维护的成本.第一次看是看的ReactNa ...
- Deep Learning(深度学习)学习笔记整理系列之(八)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(七)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(六)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(四)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
随机推荐
- Linux 软硬链接的区别及目录权限对软硬链接的影响
目录权限的影响 首先,构建实验环境如下图: 有 A.B 两个目录,A 目录下建有 test 文件,且文件中的内容为 "Hello".B 目录下分别创建 test 文件的硬链接 te ...
- SQL Server 一列或多列重复数据的查询,删除(转载)
转载来源:https://www.cnblogs.com/sunxi/p/4572332.html 业务需求 最近给公司做一个小工具,把某个数据库(数据源)的数据导进另一个数据(目标数据库).要求导入 ...
- spring boot拦截器中获取request post请求中的参数
最近有一个需要从拦截器中获取post请求的参数的需求,这里记录一下处理过程中出现的问题. 首先想到的就是request.getParameter(String )方法,但是这个方法只能在get请求中取 ...
- wordpress的excerpt()函数
问题:在wordpres中的single页面,本身引用的<?php the_excerpt(); ?>,但是在页面上显示的却是文章的内容 原因:the_excerpt(); 在excerp ...
- Linux常用命令--文件操作
常用Linux命令笔记(1) 1. 创建文件/文件夹 参考博客:https://www.cnblogs.com/lclq/p/5741852.html. 使用cat命令创建新文件: 输入命令 # ca ...
- git-lfs插件
Git本地会保存文件所有版本,对于大文件很容易导致仓库体积迅速膨胀 为了解决这个问题,Github在2015.4宣布推出Git LFS(Large File Storage),详见:Announcin ...
- sql面试 查找每个班级的前5名学生(取分类数据的前几条数据)
关键字PARTITION BY 自己看代码喽~ SELECT * FROM ( SELECT ROW_NUMBER() OVER (PARTITION BY ClassType ORDER BY Sc ...
- [20190419]shared latch spin count 2.txt
[20190419]shared latch spin count 2.txt --//上午测试shared latch XX模式的情况,链接:http://blog.itpub.net/267265 ...
- numpy 基础操作
Numpy 基础操作¶ 以numpy的基本数据例子来学习numpy基本数据处理方法 主要内容有: 创建数组 数组维度转换 数据选区和切片 数组数据计算 随机数 数据合并 数据统计计算 In [1]: ...
- HTML 、XHTML、H5的区别:
概括: HTML指的是HTML4.01:HTML是标记/设计语言.XHTML是HTML的过渡版:XHTML是可扩展的标记语言. H5是HTML的升级版.H5是一门编程语言. 区别: 1.XHTML标签 ...