草庐IT

keyword-argument

全部标签

php - 警告 : Missing Argument 1

我的php代码有一些问题:返回所有信息,但我无法弄清楚为什么会出现错误。对于我的索引页面,我只包含了实际使用该类的代码行,除了一些包含之外,实际上没有其他代码。我确定这是我构建__contstruct的方式,但我不确定这样做的适当方式。我遗漏了一些关于如何从索引页面调用它的内容。我的__construct的这行代码没有错误,但我不希望在我的类中分配变量。publicfunction__construct(){$this->user_id='235454';$this->user_type='FullTimeEmployee';}这是我的类(class)user_id=$user_id;

php - fatal error : Uncaught ArgumentCountError: Too few arguments to function

我知道有一些与此相关的问题,但有C++或其他语言的问题。我得到这个错误,我不确定我的功能有什么问题。我的错误是这样的:Fatalerror:UncaughtArgumentCountError:ToofewargumentstofunctionUser::register(),2passedinC:\xampp\htdocs\register.phponline39andexactly5expectedinC:\xampp\htdocs\classes\users.php:22Stacktrace:#0C:\xampp\htdocs\register.php(39):User->reg

php - FPDF 错误 : Unable to find "startxref" keyword

我有一个使用FPDF呈现PDF的应用程序.它工作正常,但由于某些原因我不得不更改PDF文件,现在我收到此错误:无法找到“startxref”关键字如果我恢复原始文件,会发生同样的错误。如何修复此错误? 最佳答案 您只需将本地路径而不是URI传递给setSourceFile(). 关于php-FPDF错误:Unabletofind"startxref"keyword,我们在StackOverflow上找到一个类似的问题: https://stackoverflo

php - 为什么我得到 : Warning: printf() Too few arguments in php

我得到了错误Warning:printf()[function.printf]:Toofewarguments看看我看到的代码:functiontwentyten_posted_on(){printf(sprintf('%3$s',get_permalink(),esc_attr(get_the_time()),get_the_date()));}似乎是什么问题? 最佳答案 printf()和sprintf()函数是相同的;它们行为的唯一区别在于,一个是语句(它做某事),另一个是函数表达式(它计算出某物)。(有关差异的描述,请参阅t

php - 警告 : Missing 1 argument

知道为什么我会收到此错误:Warning:Missingargument1forperson::__construct(),calledin/home/fishbein/public_html/dev/OOP/index.phponline5anddefinedin/home/fishbein/public_html/dev/OOP/class_lib.phponline6Warning:Missingargument1forperson::__construct(),calledin/home/fishbein/public_html/dev/OOP/index.phponline6

php - 我收到此错误代码 : Invalid argument supplied for foreach()

这个问题在这里已经有了答案:WhydoesthisPDOstatementsilentlyfail?(1个回答)关闭5年前。我正在学习PDO,我感到非常困惑,我在下面有这段代码,对我来说一切正常,但是我收到了这个错误代码,我不知道我必须做些什么来修复它,请帮助我:';$sql="SELECT*FROMstickercollections";foreach($dbh->query($sql)as$row){echo$row["collection_brand"]."-".$row["collection_year"]."";}$dbh=null;}catch(PDOException$e

php - 查询生成器 : passing argument to anonymous function

我在将变量传递给查询构建器闭包时遇到问题,这是我的代码:functionget_usersbyname($name){dd($name);$resultset=DB::table('users')->where(function($query){$query->where('username','LIKE',$name);});....}如果我运行它,它会返回错误“undefinednamevariable”,但我已经传递了$name变量并检查了它是否存在。我也找不到任何资源解释如何将变量传递给查询生成器匿名函数。你能帮我解决这个问题吗? 最佳答案

php - symfony2 应用程序,流浪者和 Ant : stty: standard input: Invalid argument

我正在尝试将我的开发环境(symfony2应用程序)从我的Windows7本地主机移动到使用vagrant和默认ubuntu10.0464位机器的虚拟机。一切都已准备就绪,几乎可以正常工作,但有一件事困扰着我:当我运行ant并执行phpunit时,在执行我自制的Bootstrap时出现以下错误:stty:standardinput:Invalidargument我可以将问题缩小到以下代码行,它执行symfonycache:warmup命令:executeCommand($application,"cache:warmup");这会执行以下命令:phpapp/console-etest-

php - sem_release() : failed to release key 0xc: Invalid argument

我正在使用信号量来同步我的应用程序中的某些部分。在释放信号量(sem_release)时,我收到此警告:sem_release():failedtoreleasekey0xc:Invalidargument首先我不知道信号量是否释放,但由于我没有得到“真”结果,我猜它没有释放。PHP版本:5.6.30ipcs-V=>来自util-linux2.25.2的ipcs这是信号量:keysemidownerpermsnsems0x0000000c4124122myUser6663这是部分代码(同步类):...if(!($this->semaphoreId=sem_get($this->id,1

php - 我应该使用 Controller Argument 还是 uri->segment?

应该使用Controller参数functionview($post_id){...}或uri->段functionview(){...$post_id=$this->uri->segment(3);...}仅用于简单的博客文章ID。有区别吗? 最佳答案 我会使用Controller参数。然后,如果您必须移动代码并将其放在子目录中,它仍然可以工作,而segment方法则不能。 关于php-我应该使用ControllerArgument还是uri->segment?,我们在StackOve