使用 exec 调用/调用 php 类中的方法
在 php 中,假设 test.php
中有一个名为“test_class”的类,它有两个方法:method_1
和 method_2
。
这是我的 test.php
文件:
class test_class
{
function method_1
{ ....... }
function method_2
{ ....... }
}
现在,使用其他 php 文件中的“exec”命令,我只想运行 test_class 中的 method_1。
我想知道如何实现这一目标?
In php suppose there is a class named as 'test_class' in test.php
with two methods: method_1
and method_2
.
This is my test.php
file:
class test_class
{
function method_1
{ ....... }
function method_2
{ ....... }
}
Now, using the "exec" command from other php file, I want to run only the method_1 in the test_class.
I want to know how this can be achieved?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以这样做:
You can do this instead:
您读过手册吗?
exec
并不意味着调用方法,它用于:Have you read the manual?
exec
isn't meant to call methods, it's used to: