我必须根据某些条件从我的PHP脚本中显示一个页面.我有一个if条件,如果条件满足,我正在做"包含".
if(condition here){
include "myFile.php?id='$someVar'";
}
Run Code Online (Sandbox Code Playgroud)
现在问题是服务器有一个文件"myFile.php",但我想用一个参数(id)调用这个文件,"id"的值会随着每次调用而改变.
有人可以告诉我如何实现这一目标吗?谢谢.
试图在这里运行一个项目的运行代码分析,并得到一些警告说,像这样:
CA1002:Microsoft.Design:在' SomeClass.SomeProtectedOrPublicProperty '中更改'List < SomeType > '以使用Collection,ReadOnlyCollection或KeyedCollection
我为什么要用Collection<T>而不是List<T>?当我查看msdn文档时,它们看起来几乎相同.在阅读了警告的错误帮助后,我发现了
System.Collections.Generic.List(T)_是一个通用集合,专为性能而非继承而设计,因此不包含任何虚拟成员.
但这究竟意味着什么呢?我应该做什么呢?
我应该继续在List<T>内部使用,然后在属性中返回一个new Collection<T>(someList)而不是?或者我应该开始使用Collection<T>而不是List<T>?
我想为我自己的自定义命令创建一个POD,并使用pod2usage()函数显示该语法的语法.
谁能给我一个简单的例子呢?
此致,阿南丹
如果我想使用UNC路径实例化DirectoryInfo对象
DirectoryInfo myDI = new DirectoryInfo (@"\\server\share");
Run Code Online (Sandbox Code Playgroud)
如何传递访问该共享所需的用户名/密码?
谢谢
只是想知道如何取消选择选择选项框,我使用.remove(),但这实际上删除了选择框中的文本,
还有其他办法吗?
谢谢
当我在ItemsControl中的项目上有背景颜色,并将边距设置为0时,WPF会在项目之间留下细线,好像ItemsControl包装管道占用了一小部分空间.我用Snoop检查了可视化树,所有边距都设置为0,0,0,0.
导致这些线路的原因是什么,我该如何避免它们?
alt text http://i32.tinypic.com/9tzh1d.png
XAML:
<DockPanel>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Background="Yellow" >
<ItemsControl ItemsSource="{Binding CustomerList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Background="DarkGreen">
<TextBlock Text="{Binding LastName}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<DockPanel Margin="10"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</StackPanel>
</DockPanel>
Run Code Online (Sandbox Code Playgroud)
代码隐藏:
using System.Windows;
using System.ComponentModel;
using System.Collections.ObjectModel;
namespace TestItemsControl2938
{
public partial class Window1 : Window, INotifyPropertyChanged
{
private ObservableCollection<Customer> _customerList = new ObservableCollection<Customer>();
public ObservableCollection<Customer> CustomerList
{
get
{
return _customerList;
}
set
{
_customerList = value;
OnPropertyChanged("CustomerList");
}
}
public …Run Code Online (Sandbox Code Playgroud) 有时微软的异常消息令人愤怒无益.我创建了一个很好的小MVC方法来呈现文本.方法体如下.当它到达"DrawString"方法时,我得到一个异常,说"参数无效".
请注意,我能说的最好的字体构造正确(我只是在10pt使用Arial),rect大小是正面且有效的看起来,画笔是白色的SolidBrush并且格式标志不影响输出;即如果我从调用中排除格式标志,我仍然会收到错误.
DrawString调用就在底部附近.
public ActionResult RenderText(
string fontFamily,
float pointSize,
string foreColor,
string backColor,
bool isBold,
bool isItalic,
bool isVertical,
string align,
string[] allText,
int textIndex)
{
// method renders a horizontal or vertical text image, taking all the text strings that will be rendered in each image
// and sizing the final bitmap according to which text would take the most space, thereby making it possible to render
// a selection of text images all at the same size. …Run Code Online (Sandbox Code Playgroud)