我有这个类,我想runSecond从Gettest方法中获取第二个方法中的值.我该怎么办?
class Test {
public static function Gettest($x, $y, $z){
$x = $x;
$x = $x . basename($y);
self::runSecond();
}
private function runSecond(){
//how do I access $x here? I need to know the value of $x, $y and $z here
// and I dont want to pass it like this self::runSecond($x, $y, $z)
}
}
Run Code Online (Sandbox Code Playgroud) 我试图找到此字符串中两个下划线(_)之间的数字
234534_45_92374
3433_9458_034857
zx_8458_047346daf
Run Code Online (Sandbox Code Playgroud)
什么是正则表达式?
我有不同的字符串,但所有的stings都以doc或pdf文件结尾C:\ profiles\gim.doc C:\ doc\myprofile\profile.pdf
我想从路径中获取文件名.什么是最快的方式
我有一个下面的代码,<?=但不是<?或<?php
<?= $form->create('Upload', array('type'=>'file')); ?>
<?= $form->input('file', array('type'=>'file')); ?>
Run Code Online (Sandbox Code Playgroud)
做了<?=什么
谢谢
我有
$test = array();
if(isset($ln[8])){
$test[] .= $id[0].'=>'.$ln[14];
}
Run Code Online (Sandbox Code Playgroud)
但它就像这样放置数组
array (
[0]=> 6525 => 120
[1]=> 6521 => 1243
[2]=> 5214 => 1674
[3]=> 6528 => 155
)
Run Code Online (Sandbox Code Playgroud)
而我希望它能做到这一点
array (
6525 => 120
6521 => 1243
5214 => 1674
6528 => 155
)
Run Code Online (Sandbox Code Playgroud)
我该怎么做
我是新蛋糕php,我的应用程序中有一个插件文件夹
app/plugins
Run Code Online (Sandbox Code Playgroud)
在插件文件夹中我有模型和供应商文件夹.(注意我没有任何视图或控制器文件夹)
app/plugins/model
app/plugins/vendors
Run Code Online (Sandbox Code Playgroud)
我想在插件文件夹中添加一个组件,所以我将控制器文件夹添加到其中并将组件文件放在那里.
app/plugins/controllers
app/plugins/controllers/myComp.php
Run Code Online (Sandbox Code Playgroud)
myComp.php中的方法是
class myCompComponent extends EmailComponent {
function hilpot() {
Run Code Online (Sandbox Code Playgroud)
在我的vendors/shells/tasks文件夹中,我有一个名为my_test.php的文件
在文件中,我已经包含了类似的组件
var $components = array('myComp');
Run Code Online (Sandbox Code Playgroud)
在同一个文件中,我有一个假设调用myComp方法的方法
function _Maikle()
{
$this->myComp->hilpot() = array(
...................
..................
Run Code Online (Sandbox Code Playgroud)
此时它失败并出现以下错误
PHP Fatal error: Call to undefined method stdClass::hilpot() in C:\wamp\www\folder\app\plugins\vendors\shells\my_test.php on line 87
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激
我在c#中有以下代码
if ((l = d.Length) > 0)
{
for (i = 0; i < l; i++)
{
Console.WriteLine(d[i]["id"]);
}
}
Run Code Online (Sandbox Code Playgroud)
它在l和i下放了一个小红点,当我将鼠标悬停在它上面时,它说
if ((l = d.Length) > 0)
{
for (i = 0; i < l; i++)
{
Console.WriteLine(d[i]["id"]);
}
}
Run Code Online (Sandbox Code Playgroud)
为什么感谢
仍然有问题
我有以下代码.只要我在试试{}它写得很好.但是当出现错误时,它不会写入日志文件.不知道为什么
private static void jk(string kName, string path)
{
Job job;
try
{
// run some functions here and then write to the file
StreamWriter LJ = new StreamWriter("C:\\Lob.txt");
LJ.WriteLine("XXXXXXXXXXXX");
LJ.Close();
}
catch (InvalidException)
{
StreamWriter LJ = new StreamWriter("C:\\Lob.txt");
LJ.WriteLine("YYYYYYYYYYYYYYYY");
LJ.Close();
Console.WriteLine("Error: ");
return;
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个返回对象的方法:
private object myObjectMethod(){
//...
return myObject;
}
Run Code Online (Sandbox Code Playgroud)
但在另一种方法中,我想要检索此对象:
private void myotherMethod(){
var x = myObjectMethod();
// Now how would I access the properties of myObject?
}
Run Code Online (Sandbox Code Playgroud)