douxian6086 2015-12-29 12:38
浏览 38

如何从代码中隐藏逻辑并仅显示带有文档的公共函数?

When I control click into a php function, it drives me to its definition and I can see the documentation and the function declaration, but no logic inside. The brackets are empty. I would like to know how if its posible to do something similar in my code and how it can be done.

What i dont understand is that there is no code inside this class file, and no include statements, but the methods works when I use them in my code. And when I click onto these methods I'm linked to this file. How can I do something similar or how does it works?? This is an exmample of what I would like to do:

/**
 * Retrieve item from the server
 * @link http://www.php.net/manual/en/memcache.get.php
 * @param key string <p>
 * The key or array of keys to fetch.
 * </p>
 * @param flags int[optional] <p>
 * If present, flags fetched along with the values will be written to this parameter. These
 * flags are the same as the ones given to for example Memcache::set.
 * The lowest byte of the int is reserved for pecl/memcache internal usage (e.g. to indicate
 * compression and serialization status).
 * </p>
 * @return string the string associated with the key or
 * an array of found key-value pairs when key is an array.
 * Returns false on failure, key is not found or
 * key is an empty array.
 */
public function get ($key, &$flags = null) {}

/**
 * Delete item from the server
 * @link http://www.php.net/manual/en/memcache.delete.php
 * @param key string <p>
 * The key associated with the item to delete.
 * </p>
 * @param timeout int[optional] <p>
 * This deprecated parameter is not supported, and defaults to 0 seconds.
 * Do not use this parameter.
 * </p>
 * @return bool Returns true on success or false on failure.
 */
public function delete ($key, $timeout = null) {}
  • 写回答

1条回答 默认 最新

  • dounai7148 2015-12-29 12:53
    关注

    These are stubs for documentation. There is no technique of hiding the code here.

    The actual code isn't PHP and can be found for example here https://github.com/php/php-src/tree/master/ext/standard

    or can be downloaded at the php.net website.

    评论

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值